I'm working on a container that uses Git to interact with some git repositories. But, to use Git it has to use the SSH keys that are stored on the Windows host machine. I tried two of the ways I could think of and both of them seem to have a problem.

  1. I tried mounting the location of the keys to /root/.ssh but the git flashes the error for insecure keys. The reason is that the permission of the keys is not 600. I tried running an entrypoint script that changes the permission of all the files inside /root/.ssh to 600 but, the permission doesn't change probably because the underlying filesystem is NTFS.

  2. I tried mounting the location of keys to a random location inside the container (say, /tmp) and tried copying the content of /tmp to /root/.ssh using the entrypoint script and change their permission to 600 but, in this case, if the container generates new keys, these keys will not be saved on the host and will be lost when the container dies.

  • Could you add the docker-compose.yml or docker run commands to the question? Please also indicate what image you are using so that the issue can be reproduced.
    – 030
    Dec 25 '19 at 10:17

Browse other questions tagged or ask your own question.