Symbolic link to docker container on host machine

63 Views Asked by At

I have a docker container that contains a GitHub repository with code that I work on. The code is just inside the container and I connect via VSCode WSL extension to it. Now I want to use GitHub Desktop (to for example cherry pick), is there a way to create a symbolic link on the host machine to the container folder, so that GitHub Desktop can see the folder?

Or might it be an option to create a volume in Docker and use this somehow with GitHub Desktop?

1

There are 1 best solutions below

1
On

You can't do this. A Docker container (as a core Docker feature) has a filesystem that's isolated from the host system, so the host can't directly access the container's files, and vice versa. A symlink just provides a pointer to another file by name, and it can't help cross this boundary.

Because of Docker's filesystem isolation features, I don't generally recommend forcing it into a developer workflow. As a developer you usually need to work directly on the files, and you need direct access to developer tools; hiding them inside a container just makes everything harder and requires dedicated IDE support.

If your source code is directly on the host, and you have the git CLI and other routine developer tools available, then you can also use tools like GitHub Desktop without any special setup.