features icon indicating copy to clipboard operation
features copied to clipboard

Wayland socket deleted by features/docker-in-docker

Open hellodword opened this issue 2 years ago • 2 comments

Now the vscode will automatically mount the host's wayland socket to /tmp/vscode-wayland-<...>.sock.

But it will be deleted by features/docker-in-docker, I don't know why, but here is a minimal reproduce:

Working:

{
    "image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04"
}
$ ls -l $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY
lrwxrwxrwx 1 vscode vscode 61 Feb 15 05:02 /tmp/user/1000/vscode-wayland-86517b0c-d95b-425d-a14d-390c5c1f8719.sock -> /tmp/vscode-wayland-86517b0c-d95b-425d-a14d-390c5c1f8719.sock

$ ls -l /tmp/vscode-wayland-86517b0c-d95b-425d-a14d-390c5c1f8719.sock
srwxr-xr-x 1 vscode users 0 Feb 15 04:50 /tmp/vscode-wayland-86517b0c-d95b-425d-a14d-390c5c1f8719.sock

Not working:

{
    "image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04",
    "features": {
        "ghcr.io/devcontainers/features/docker-in-docker:2": {}
    }
}
$ ls -l $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY
lrwxrwxrwx 1 vscode vscode 61 Feb 15 04:57 /tmp/user/1000/vscode-wayland-af803a78-5a61-4459-bb98-af49440be50f.sock -> /tmp/vscode-wayland-af803a78-5a61-4459-bb98-af49440be50f.sock

$ ls -l /tmp/vscode-wayland-af803a78-5a61-4459-bb98-af49440be50f.sock
ls: cannot access '/tmp/vscode-wayland-af803a78-5a61-4459-bb98-af49440be50f.sock': No such file or directory

hellodword avatar Feb 15 '24 05:02 hellodword

Hi 👋

I wonder if /usr/local/share/docker-init.sh is the root cause? especially 👇

https://github.com/devcontainers/features/blob/main/src/docker-in-docker/install.sh#L388-L391

If /tmp is not a mount point, it mounts a tmpfs filesystem at /tmp which might overwrite the /tmp/vscode-wayland-<...>.sock contents ?

samruddhikhandale avatar Feb 16 '24 01:02 samruddhikhandale

Hi 👋

If /tmp is not a mount point, it mounts a tmpfs filesystem at /tmp which might overwrite the /tmp/vscode-wayland-<...>.sock contents ?

It seems that the automatically forwarded ssh socket is mounted to the /tmp/*.sock, dont know why but it works well with docker-in-docker🤔

$ ls -l /tmp/*.sock
srwxr-xr-x 1 vscode vscode 0 Feb 16 01:26 /tmp/vscode-ipc-8912c6bd-0266-4ae3-8e41-e5e3bd8c3864.sock
srwxr-xr-x 1 vscode vscode 0 Feb 16 01:26 /tmp/vscode-remote-containers-ipc-2a137e71-76f2-49a9-802b-98d8c0508b3f.sock
srwxr-xr-x 1 vscode vscode 0 Feb 16 01:26 /tmp/vscode-ssh-auth-2a137e71-76f2-49a9-802b-98d8c0508b3f.sock
  • https://github.com/microsoft/vscode-docs/blob/804ba516030bcd2c03afda5c9c8fc60763d05a0c/remote-release-notes/v1_37.md#ssh-agent-forwarding
  • https://github.com/microsoft/vscode-docs/blob/804ba516030bcd2c03afda5c9c8fc60763d05a0c/remote-release-notes/v1_41.md#forwarding-ssh-agent
  • https://github.com/microsoft/vscode-docs/blob/804ba516030bcd2c03afda5c9c8fc60763d05a0c/remote-release-notes/v1_46.md#gpg-forwarding
  • https://github.com/microsoft/vscode-docs/blob/804ba516030bcd2c03afda5c9c8fc60763d05a0c/remote-release-notes/v1_74.md#improved-ssh-agent-and-gpg-agent-forwarding

hellodword avatar Feb 16 '24 01:02 hellodword