unable to invoke docker container

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

The following is the dockerfile used:

  • How do I expose ports on Heroku with a Dockerfile?
  • Weave plugin on AWS EC2
  • Dockerfile FROM Instruction
  • Pull a local image to run a pod in Kubernetes
  • How to run multiple docker container on one mesos slave node?
  • Getting started with Laradock on Mac
  • 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

  • Node.js web application not running properly in Docker stack
  • Dockerfile for multiple Docker containers
  • Hazelcast discovery not working with AWS + Docker
  • Mounting directory in docker container and running Gradle command
  • How to deploy a docker container on a remote ubuntu server?
  • Spotify docker maven build multiple images
  • 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.