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 docker.io 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.

  • How is a Docker Machine marked as active?
  • Dockerized Nginx and Django, how to serve static files
  • How to re-add a container in Bluemix
  • Assign port to container
  • Invalid Registry Endpoint pushing docker image
  • cURL from host-to-container works, but from container-to-container does not
  • What is the docker way of dealing with files as program parameters?

  • Docker container with multiple configurable ports
  • Docker container exits immediately
  • How to manage secrets in a Microservice / Container / Cloud environment?
  • How to compile from a remote machine ?
  • How to monitor user activity on docker
  • docker cannot start service from DockFile
  • 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.

    See: https://docs.docker.com/engine/tutorials/dockervolumes/

    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

    e.g.

    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)

    CMD["/my/path/to/run.sh"]
    

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

    e.g.

    ./runmything.sh $ENV_TO_INJECT
    

    Would that work for you?

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