cli icon indicating copy to clipboard operation
cli copied to clipboard

Container name doesn't take into account the id-label

Open hpe-ykoehler opened this issue 3 years ago • 2 comments

I build from two folders:

mybuild/target1/module/ mybuild/target2/module/

The same docker container is used for both, the above uses docker-compose, I would have expected that since the path is different the container name would also be.

It seems that the docker-compose project name is identical for both, so one of them fails to be created.

I would expect the devcontainer to pass by default different project-name using a hash from the workspace-folder + the idlabels.

I would also expect the container-name itself to include the idlabels as part of the hash and not just the workspaceFolder.

hpe-ykoehler avatar Oct 07 '23 03:10 hpe-ykoehler

Hi 👋

I would also expect the container-name itself to include the idlabels as part of the hash and not just the workspaceFolder.

'id-label': { type: 'string', description: 'Id label(s) of the format name=value. These will be set on the container and used to query for an existing container. If no --id-label is given, one will be inferred from the --workspace-folder path.' },

Yes, currently with 'id-label' one can query for a container, but I don't believe it is used by container name creation. However, you make a very good point of using it for simpler distinguishing between containers.

// cc @chrmarti

samruddhikhandale avatar Oct 09 '23 22:10 samruddhikhandale

We try to stick to Docker Compose's default behavior here which is to use the basename of the docker-compose.yml's folder. (One exception is when that is the .devcontainer folder where we add the parent folder's basename to the project name.)

chrmarti avatar Jan 05 '25 21:01 chrmarti