Docker. No such file or directory

I have some files which I want to move them to a docker container.
But at the end docker can’t find a file..

The folder with the files on local machine are at /home/katalonne/flask4

  • Error starting docker daemon
  • exporting DOCKER_HOST in .bashrc produces a different result to the same command in the terminal
  • Boot2docker on windows got “Permission denied” error
  • Error getting IP address: Something went wrong running an SSH command! command
  • Boot2Docker starting Ubuntu image
  • How to connect two docker containers through localhost?
  • File Structure if it matters:

    File Structure if it matters
    The Dockerfile:

    # First Flask App Dockerfile
    # Pull base image.
    FROM centos:7.0.1406
    # Build commands
    RUN yum install -y python-setuptools mysql-connector mysql-devel gcc python-devel
    RUN easy_install pip
    RUN mkdir /opt/flask4
    WORKDIR /opt/flask4
    ADD requirements.txt /opt/flask4
    RUN pip install -r requirements.txt
    ADD . /opt/flask4
    # Define deafult command.
    CMD ["python",""]
    # Expose ports.
    EXPOSE 5000

    So I built the image with this command :

    docker build -t flask4 .

    I ran the container with volume by :

    docker run -d -p 5000:5000 -v /home/Katalonne/flask4:/opt/flask4 --name web flask4

    And when I want to run the file on the container :

    docker logs -f web

    I get this error that it can not find my file :

    python: can't open file '': [Errno 2] No such file or directory

    What is my fault?

    P.S. : I’m a Docker and Linux partially-noob.

  • How can you limit which users have Docker exec access in a shared environment?
  • Docker build: returned a non-zero code: 1
  • Publishing Docker to AWS from Visual Studio
  • Getting docker daemon not running error
  • Redis connection failing
  • Docker container reach outside network addresses
  • One Solution collect form web for “Docker. No such file or directory”

    The files and directories that are located in the same location as your Dockerfile are indeed available (temporarily) to your docker build. But, after the docker build, unless you have used ADD or COPY to move those files permanently to the docker container, they will not be available to your docker container after the build is done. This file context is for the build, but you want to move them to the container.

    You can add the following command:

    ADD . /opt/flask4
    ADD . . 
    # Define deafult command.
    CMD ["python",""]

    The line ADD . . should copy over all the things in your temporary build context to the container. The location that these files will go to is where your WORKDIR is pointing to (/opt/flask4).

    If you only wanted to add to your container, then use


    So, when you run CMD ["python",""], the pwd that you will be in is /opt/flask4, and should be in there, and running the command python in that directory should work.


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