You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| installDockerComposeSwitch | Install Compose Switch (provided docker compose is available) which is a replacement to the Compose V1 docker-compose (python) executable. It translates the command line into Compose V2 docker compose then runs the latter. | boolean | true |
26
+
| socketPath | Path where the Docker socket is mounted inside the container. For rootless Docker, override the mount in devcontainer.json to map your host socket to this path. | string | /var/run/docker-host.sock |
26
27
27
28
## Customizations
28
29
@@ -36,6 +37,30 @@ Re-use the host docker socket, adding the Docker CLI to a container. Feature inv
36
37
- The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, for example.
37
38
- This approach does not currently enable bind mounting the workspace folder by default, and cannot support folders outside of the workspace folder. Consider whether the [Docker-in-Docker Feature](../docker-in-docker) would better meet your needs given it does not have this limitation.
38
39
40
+
## Rootless Docker Support
41
+
42
+
By default, this feature expects the Docker socket at `/var/run/docker.sock` on the host, which works for standard (root) Docker installations. For **rootless Docker** setups where the socket is located at `/run/user/$UID/docker.sock` or `$XDG_RUNTIME_DIR/docker.sock`, you need to override the mount in your `devcontainer.json`:
- Replace `1000` with your actual user ID (run `id -u` to find it)
61
+
- The feature will automatically detect the socket at `/var/run/docker-host.sock`
62
+
- Your custom mount will override the feature's default mount
63
+
39
64
## Supporting bind mounts from the workspace folder
40
65
41
66
A common question that comes up is how you can use `bind` mounts from the Docker CLI from within the a dev container using this Feature (e.g. via `-v`). If you cannot use the [Docker-in-Docker Feature](../docker-in-docker), the only way to work around this is to use the **host**'s folder paths instead of the container's paths. There are 2 ways to do this
"description": "Re-use the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.",
8
-
"options": {
9
-
"version": {
10
-
"type": "string",
11
-
"proposals": [
12
-
"latest",
13
-
"none",
14
-
"20.10"
15
-
],
16
-
"default": "latest",
17
-
"description": "Select or enter a Docker/Moby CLI version. (Availability can vary by OS version.)"
18
-
},
19
-
"moby": {
20
-
"type": "boolean",
21
-
"default": true,
22
-
"description": "Install OSS Moby build instead of Docker CE"
23
-
},
24
-
"mobyBuildxVersion": {
25
-
"type": "string",
26
-
"default": "latest",
27
-
"description": "Install a specific version of moby-buildx when using Moby"
28
-
},
29
-
"dockerDashComposeVersion": {
30
-
"type": "string",
31
-
"enum": [
32
-
"none",
33
-
"latest",
34
-
"v1",
35
-
"v2"
36
-
],
37
-
"default": "latest",
38
-
"description": "Compose version to use for docker-compose (v1 or v2 or none or latest)"
"description": "Re-use the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.",
8
+
"options": {
9
+
"version": {
10
+
"type": "string",
11
+
"proposals": [
12
+
"latest",
13
+
"none",
14
+
"20.10"
15
+
],
16
+
"default": "latest",
17
+
"description": "Select or enter a Docker/Moby CLI version. (Availability can vary by OS version.)"
18
+
},
19
+
"moby": {
20
+
"type": "boolean",
21
+
"default": true,
22
+
"description": "Install OSS Moby build instead of Docker CE"
23
+
},
24
+
"mobyBuildxVersion": {
25
+
"type": "string",
26
+
"default": "latest",
27
+
"description": "Install a specific version of moby-buildx when using Moby"
28
+
},
29
+
"dockerDashComposeVersion": {
30
+
"type": "string",
31
+
"enum": [
32
+
"none",
33
+
"latest",
34
+
"v1",
35
+
"v2"
36
+
],
37
+
"default": "latest",
38
+
"description": "Compose version to use for docker-compose (v1 or v2 or none or latest)"
39
+
},
40
+
"installDockerBuildx": {
41
+
"type": "boolean",
42
+
"default": true,
43
+
"description": "Install Docker Buildx"
44
+
},
45
+
"installDockerComposeSwitch": {
46
+
"type": "boolean",
47
+
"default": false,
48
+
"description": "Install Compose Switch (provided docker compose is available) which is a replacement to the Compose V1 docker-compose (python) executable. It translates the command line into Compose V2 docker compose then runs the latter."
49
+
},
50
+
"socketPath": {
51
+
"type": "string",
52
+
"default": "/var/run/docker-host.sock",
53
+
"description": "Path where the Docker socket is mounted inside the container. For rootless Docker, override the mount in devcontainer.json to map your host socket to this path."
54
+
}
44
55
},
45
-
"installDockerComposeSwitch": {
46
-
"type": "boolean",
47
-
"default": true,
48
-
"description": "Install Compose Switch (provided docker compose is available) which is a replacement to the Compose V1 docker-compose (python) executable. It translates the command line into Compose V2 docker compose then runs the latter."
apt-get -y install --no-install-recommends ${cli_package_name}${cli_version_suffix}"${buildx[@]}"|| { err "It seems packages for moby not available in OS ${ID}${VERSION_CODENAME} (${architecture}). To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS version (eg: 'ubuntu-24.04').";exit 1 ; }
321
-
apt-get -y install --no-install-recommends moby-compose ||echo"(*) Package moby-compose (Docker Compose v2) not available for OS ${ID}${VERSION_CODENAME} (${architecture}). Skipping."
322
+
if [ "${DOCKER_DASH_COMPOSE_VERSION}"!="v1" ];then
323
+
apt-get -y install --no-install-recommends moby-compose ||echo"(*) Package moby-compose (Docker Compose v2) not available for OS ${ID}${VERSION_CODENAME} (${architecture}). Skipping."
0 commit comments