How to send files as arguments of docker commands?

I’m not sure that I’m trying to do it the right way, but I would like to use as a way to package some programs that need to be run from the host.

However these applications take filenames as arguments and need to have at least read access. Some other applications generate files as output and the user expects to retrieve those files.

  • Server setup: Subdomain or different port for API and single or multiple ssl certificates for a docker, nginx, web and api setup?
  • Can't access SQL db inside Docker container
  • Can I bind a port while building a docker image?
  • JFrog artifactory docker image size trough REST
  • run netflixoss docker on windows 8.1
  • docker rmi cannot remove images, with: no such id
  • What is the docker way of dealing with files as program parameters?

  • fig invalid repository name error
  • docker-compose volumes don't contain latest static code from image
  • get docker images command's output with bash script
  • Docker for AWS and Selenium Grid - Connection refused / No route to host (Host unreachable)
  • Lowercase images names in docker
  • Mounting volumes before executing commands with docker-compose and boot2docker
  • 2 Solutions collect form web for “How to send files as arguments of docker commands?”

    Start Docker with a mounted volume and use this to directory to manipulate files.


    If you have apps that require args when they’re run then you can just inject your parameters as environment variables when you run your docker container


    docker run -e ENV_TO_INJECT=my_value .....

    Then in your entrypoint (or cmd) make sure you just run a shell script

    e.g. (in Dockerfile)


    Then in your file that gets run at container launch you can just access the environment variables



    Would that work for you?

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