

In addition to the above problem, you can’t mount in files that exist directly in your WSL drive. You can’t Docker volume mount files from directly inside of WSL: So you’re stuck with 777 permissions when mounting in your SSH keys through Windows. Your SSH folder and files will all be set to 777 and SSH won’t work with those permissions.Īs of Windows 10 Spring 2018 edition, you can mount in your drives into WSL using metadata which supports Linux file permissions, and that’s fantastic, but Docker for Windows mounts that drive in through CIFS and that will strip out the metadata. Unfortunately Windows doesn’t respect Linux file permissions. But What about Windows (specifically WSL)? This just removes the possibility of you overriding your SSH keys in the container by accident.

I like adding in the extra :ro bit to the volume mount to make it read-only. If you’re running Linux or MacOS, that’s all you need to do. Just run: docker run -rm -it -v ~/.ssh:/root/.ssh:ro alpine. Just mount in your SSH directory and you're done, but it's not that simple with Windows based Docker hosts. Updated on May 25th, 2018 in #docker Docker Tip #56: Volume Mounting SSH Keys into a Docker Container On paper this sounds easy.
