How to mount private SSH key to Docker for Windows container?

Good day everyone.

I have following dev environment:

  • Oracle Instant Client - with Docker and PHP
  • Not able to connect to docker containers using SSH [closed]
  • Cannot use mounted host directory from MongoDB with minikube
  • Docker error from CMD command prompt: Something went wrong running an SSH Command
  • Failed Installation of Docker plugin for Intellij Idea CE 2016.1 due to <required plugin “org.jetbrains.plugins.remote-run” not installed.>
  • Attach and run a command in a docker container
    • Win 10 host
    • Docker for Windows latest
    • php5.6 image running in container via docker-compose

    How can i mount my private SSH key to this container? Or is there any possibility to tunnel Pageant from host machine to container?

    All i want is to run Capifony deploy procedures in my container.

  • nginx doesnt see updated static content
  • What is the difference between CMD and ENTRYPOINT in a Dockerfile?
  • Launch service at container startup
  • Pip installs within Docker container : Locally vs Remotely
  • How to prevent docker-compose building the same image multiple times?
  • Docker warning: failed to get default registry endpoint from daemon
  • One Solution collect form web for “How to mount private SSH key to Docker for Windows container?”

    You could use a volume with -v /c/Users/<user>/.ssh/id_rsa:/<home dir>/.ssh/id_rsa:ro.
    home is ~ of the user e.g. /root, /, /home/<user>. The :ro will make it readonly, so your key will not be overwritten by accident.

    But i think you should create a new key and copy it inside the container while building the image.

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