Docker: I'm not able to make working a volume binding at runtime

I’m executing my image in this way:

docker run -it --rm my_image -v ~/.ssh/id_rsa:/home/realtebo/.ssh/id_rsa:ro

So I expect that my private rsa key is copied at runtime when executing.

  • Cadvisor -Failed to get RecentStats :unable to find data for container /system.slice/docker
  • How to configure xvfb default installation on Jenkins startup?
  • How to print IP Addresses of all running docker instances?
  • Getting Mac address from Docker Container
  • pcregrep with multiple capturing groups
  • Access Docker daemon Remote api on Docker for Mac
  • This is the shell script I used as entrypoint

    ls -la ~/.ssh

    At runtime I got this

    total 12
    drwxr-xr-x 2 realtebo realtebo 4096 Jan 19 08:20 .
    drwxr-xr-x 3 realtebo realtebo 4096 Jan 19 08:37 ..
    -rw-r--r-- 1 realtebo realtebo  393 Jan 19 08:20 known_hosts

    So the working dir and the user are ok.

    note: known_hosts is created at build time

    Why cannot I get /home/realtebo/.ssh/id_rsa as I expect ?

    I do some debugging using docker inspect <container_name. I discovered that :

    "HostConfig": {
            "Binds": null,

    But what’s the problem?

  • Docker container on windows server
  • Docker in debugging mode
  • docker-machine without TLS verification
  • Windows 10: How to track 'docker pull' traffic calls using fiddler
  • Best Docker logging architecture using ELK stack
  • How could I ping my docker container from my host
  • One Solution collect form web for “Docker: I'm not able to make working a volume binding at runtime”

    Solution: exchange -v flag and image_name.
    Image name must always be the last argument (followed by optional cmd to execute)

    So instead of

    docker run -it --rm my_image -v ~/.ssh/id_rsa:/home/realtebo/.ssh/id_rsa:ro

    I need to execute in this way:

    docker run -it --rm v ~/.ssh/id_rsa:/home/realtebo/.ssh/id_rsa:ro my_image
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.