unable to invoke docker container

Using docker i am unable to invoke the web application from the browser.

The following is the dockerfile used:

  • Is it possible to start multi physical node hadoop clustster using docker?
  • How to create a Dockerfile for cassandra (or any database) that includes a schema?
  • Not able to connect mongodb with Rails container using Docker compose
  • Scripts with dialog from Docker container
  • Dockerfile vs Dockerrun.aws.json on AWS Elastic Beanstalk
  • Docker - Unable to find any JVMs - Error checking TLS connection
  • FROM continuumio/anaconda:latest
    
    Expose 5000
    
    ADD . /code-directory
    
    WORKDIR code-directory
    
    RUN conda install opencv
    
    RUN pip install boto3
    
    RUN pip install boto
    
    RUN pip install flask
    RUN pip install pathlib
    
    ADD facedetection_video.py facedetection_video.py
    
    ADD UI_Interface UI_Interface
    
    WORKDIR /UI_Interface
    
    COPY . app.py
    
    RUN python app.py &
    

    The following is the contents of app.py

    from flask import Flask
    
    app = Flask(__name__)
    
    @app.route('/')
    
    def hello_world():
    
        return 'Flask Dockerized'
    
    if __name__ == '__main__':
    
        app.run(debug=True,host='0.0.0.0')
    

    The commands used to generate docker image

    docker build -t test1 .
    

    The command used to run the container

    docker run -d -p 5000:5000 test1
    

    The output status message of the container is:

    Exited (0) 3 minutes ago
    

    In the logs I could not find any error message. Pls suggest

  • How can I run 2 long commands in a docker container
  • permission denied error in docker
  • Jenkins and docker-compose
  • Where are docker images and containers stored when we use it with Windows?
  • Can I use mem_limit in docker-compose? and How?
  • Reference Zeppelin to Spark Master (in Docker Container)
  • 2 Solutions collect form web for “unable to invoke docker container”

    RUN is a Dockerfile directive to run a command at build-time to generate an image.

    What you need for running the container is to define the CMD, which represents the program that will run as a container when you execute docker run ...

    Change:

    RUN python app.py &
    

    To:

    CMD python app.py
    

    The issue is resolved.

    In the dockerfile there was error changed the dockerfile as shown below:

    FROM ubuntu:16.04

    RUN mkdir -p /usr/src/app
    WORKDIR /usr/src/app

    RUN apt-get install -y libavresample-dev

    Various Python and C/build deps

    RUN apt-get update && apt-get install -y \

    wget \
    build-essential \ 
    cmake \ 
    git \
    unzip \ 
    pkg-config \
    python-dev \ 
    python-opencv \ 
    libopencv-dev \ 
    libav-tools  \ 
    libjpeg-dev \ 
    libpng-dev \ 
    libtiff-dev \ 
    libjasper-dev \ 
    libgtk2.0-dev \ 
    python-numpy \ 
    python-pycurl \ 
    libatlas-base-dev \
    gfortran \
    webp \ 
    python-opencv \ 
    qt5-default \
    libvtk6-dev \ 
    zlib1g-dev 
    

    RUN apt-get install -y python-pip

    RUN mkdir -p ~/opencv

    RUN cd ~/opencv

    RUN apt-get install -y vim

    RUN pip install boto3

    RUN pip install boto

    RUN pip install flask

    RUN pip install pathlib

    RUN pip install scikit-video

    EXPOSE 5000

    COPY . /app
    WORKDIR /app

    ENTRYPOINT [“python”]

    CMD [“app.py”]

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.