Docker input/output outside the container

I created a docker container with a python script. The python script takes an input file, does some processing and saves output file at some specified location.

docker run /app/ --input /data/input.csv --output /data/output.csv

Since the input file can be different every time I run the script, I want it to be outside the docker container. I also would like to store the output somewhere outside the container.

  • Error while trying to build custome postgres Docker image
  • Docker Compose for Rails
  • Change DigitalOcean access token for docker-machine
  • docker images are stored in root user thus consuming my disk space
  • How to create overlay network for docker, getting error datastore for scope “global” is not initialized
  • Docker: Nginx + PHP-FPM and multiple sites
  • docker run /app/ --input /my/local/location/outside/docker/input.csv --output /my/local/location/outside/docker/output.csv

    Does docker support this? If so, how would one be able to achieve it?

    My Dockerfile looks like the following:

    FROM phusion/baseimage
    RUN apt-get update
    RUN apt-get install -y build-essential
    RUN apt-get install -y python-dev
    RUN apt-get install -y python-pip
    RUN apt-get install -y python-numpy && \
        apt-get install -y python-scipy
    COPY ./requirements.txt /app/requirements.txt
    COPY ./src/ /app/
    WORKDIR /app
    COPY . /app

  • Google Container Engine: Accessing Cloud Storage
  • Docker ERROR: Container command not found or does not exist when running from Win10
  • How to connect to a docker container from outside the host (same network) [Windows]
  • Solr on Docker:localhost:8983 not working
  • Connection refused when accessing web app through Docker
  • Is possible to deploy existing app to Docker
  • 2 Solutions collect form web for “Docker input/output outside the container”

    You could mount a directory with the file inside as a Docker data volume using the -v option:

    docker run -d -P --name myapp -v /app mydir/app python

    This will have the added benefit of allowing you to stop the container, make changes to the file, and start the container and see the change reflected within the container.

    so you should add to your Dockerfile a line

    ENTRYPOINT ["python","/app/"]

    and a

    CMD myinput

    or something similar,


    What is the difference between CMD and ENTRYPOINT in a Dockerfile?

    read the docs about


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