docker / dev-environments

63 stars 32 forks source link

set workspaceFolder other than /com.docker.devenvironments.code #98

Open lieranderl opened 2 years ago

lieranderl commented 2 years ago

I would like to connect to a remote dev container and have access to files stored inside a container. However, every time I open a dev container via Docker's Dev Environment the "workspaceFolder" is always set to "/com.docker.devenvironments.code" which is mounted to a local folder on my PC. Is any way how to change workspaceFolder to the path inside the container? Because in my case all source files are git cloned into the container. I do not store source files locally on PC, everything is inside the dev container. Currently, I can only manually change workspaceFolder at "Open Container Configuration file" in VScode. I tried to add workspaceFolder into .devcontainer.json, but seems Docker's Dev Environment ignores devcontainer.json.

Dev container configuration file by default:

Screenshot 2022-01-28 at 21 26 16
glours commented 2 years ago

Hello @jfedotov

ATM there is no way to configure the source code folder, we're looking to use Compose format to configure you Dev Environment which may allow you to change the source folder name. We don't support the .devcontainer.json configuration now but it's not exclude in the future

kb-ig commented 2 years ago

Yeah I need this option. I have my VScode title formatted so that the name of the folder is the first part of the title, so that when I have multiple windows open (which is pretty much all day every day), I can easily identify which is which. At the moment, when running multiple dev containers, I have no easy way of identifying this.

image 🤔

I'm sure there's a good reason for the workspace folder to be /com.docker.devenvironments.code, but I think it would be better if the default was for every container either used a more unique workspace folder (perhaps the container name or even just the repo name).

rumpl commented 2 years ago

I'm sure there's a good reason for the workspace folder to be /com.docker.devenvironments.code

The main reason is that it's a unique (and yes, weird) name so that there is very little chance it would already exist in the image. You could have a repo name called etc, and the container name changes so it's not a great fit.

kb-ig commented 2 years ago

I'm sure there's a good reason for the workspace folder to be /com.docker.devenvironments.code

The main reason is that it's a unique (and yes, weird) name so that there is very little chance it would already exist in the image. You could have a repo name called etc, and the container name changes so it's not a great fit.

Yeah that's a fair point. Maybe prefixing the unique folder name with the name of the repo would solve this issue. Best of both worlds.

benknight135 commented 2 years ago

I was able to get around this for the time being by creating a symlink where I wanted the folder so the /com.docker.devenvironments.code is still created as normal but is also in the location required and all changes in the devenvironments folder are mirrored in the target folder. In my dockerfile it looks like this:

RUN ln -s /com.docker.devenvironments.code /path/to/folder