Identify multiple VSCode devcontainers in the same remote docker context

316 Views Asked by At

All my team members use the same server as docker remote context. I have set up a project using VSCode-Devcontainer with a devcontainer.json like this:

{
    "name": "MyProject - DevContainer",
    "dockerFile": "../Dockerfile",
    "context": "..",
    "workspaceMount": "source=vsc-myprojekt-${localEnv:USERNAME},target=/workspace,type=volume",
    "workspaceFolder": "/workspace",
    "extensions": [
        "ms-python.python",
        "ms-python.vscode-pylance"
    ],
    "postCreateCommand": "/opt/entrypoint.sh",
    "mounts": [
        "source=/media/Pool/,target=/Pool,type=bind",
        "source=cache,target=/cache,type=volume"
    ]
}

This worked fine for me, but now as my colleges start their devcontainers, we have the problem, that a newly started devcontainer kill other already running devcontainers.

We found that the local folder of the projekt seems to by the way to identify already running devcontainers:

[3216 ms] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=d:\develop\myproject
[3839 ms] Start: Run: docker inspect --type container 8ca7d3a44662
[4469 ms] Start: Removing Existing Container

As we all use the same path this identification based on the local folder is problematic. Is there a way to use other labels?

1

There are 1 best solutions below

0
On

Seems to be a bug, because the issue I opened, was accepted as a bug report.