unable to invoke docker container

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

The following is the dockerfile used:

  • in the Dockerfile how to ADD a file without a commit?
  • docker exec command doesn't return after completing execution
  • Can't attach to bash running the Docker container
  • Dockerfile issues with build
  • How to auto restart a Docker container after a reboot in CoreOS?
  • zsh function to set docker environment on OSX
  • 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__)
    def hello_world():
        return 'Flask Dockerized'
    if __name__ == '__main__':

    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

  • Within lxc/docker container - what happens if apt-get upgrade includes kernel update?
  • Docker apache2 will not consider new 000-default.conf
  • execSync compilation failed with npm 3
  • DC/OS and concurrent deployments
  • Docker-machine error “Could not find matching IP for MAC address” on Windows 10
  • Where to store Dockerized python application configuration
  • 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 ...


    RUN python app.py &


    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 \ 

    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.