content/manuals/enterprise/security/hardened-desktop/enhanced-container-isolation/config.md
{{< summary-bar feature_name="Hardened Docker Desktop" >}}
This page shows you how to configure Docker socket exceptions and other advanced settings for Enhanced Container Isolation (ECI). These configurations enable trusted tools like Testcontainers to work with ECI while maintaining security.
By default, Enhanced Container Isolation blocks containers from mounting the Docker socket to prevent malicious access to Docker Engine. However, some tools require Docker socket access.
Common scenarios requiring Docker socket access include:
Configure Docker socket exceptions using Settings Management:
{{< tabs >}} {{< tab name="Admin Console" >}}
{{< /tab >}} {{< tab name="JSON file" >}}
Create an admin-settings.json file and add:
{
"configurationFileVersion": 2,
"enhancedContainerIsolation": {
"locked": true,
"value": true,
"dockerSocketMount": {
"imageList": {
"images": [
"docker.io/localstack/localstack:*",
"docker.io/testcontainers/ryuk:*",
"docker:cli"
],
"allowDerivedImages": true
},
"commandList": {
"type": "deny",
"commands": ["push", "build"]
}
}
}
}
{{< /tab >}} {{< /tabs >}}
The imageList defines which container images can mount the Docker socket.
| Format | Description |
|---|---|
<image_name>[:<tag>] | Name of the image, with optional tag. If the tag is omitted, the :latest tag is used. If the tag is the wildcard *, then it means "any tag for that image." |
<image_name>@<digest> | Name of the image, with a specific repository digest (e.g., as reported by docker buildx imagetools inspect <image>). This means only the image that matches that name and digest is allowed. |
Basic allowlist for testing tools:
"imageList": {
"images": [
"docker.io/testcontainers/ryuk:*",
"docker:cli",
"alpine:latest"
]
}
Wildcard allowlist (Docker Desktop 4.36 and later):
"imageList": {
"images": ["*"]
}
[!WARNING]
Using
"*"allows all containers to mount the Docker socket, which reduces security. Only use this when explicitly listing allowed images isn't feasible.
Docker Desktop validates allowed images by:
This prevents bypassing restrictions by re-tagging unauthorized images:
$ docker tag malicious-image docker:cli
$ docker run -v /var/run/docker.sock:/var/run/docker.sock docker:cli
# This fails because the digest doesn't match the real docker:cli image
For tools like Paketo buildpacks that create ephemeral local images, you can allow images derived from trusted base images.
"imageList": {
"images": [
"paketobuildpacks/builder:base"
],
"allowDerivedImages": true
}
When allowDerivedImages is true, local images built from allowed base images (using FROM in Dockerfile) also gain Docker socket access.
Blocks specified commands while allowing all others:
"commandList": {
"type": "deny",
"commands": ["push", "build", "image*"]
}
Only allows specified commands while blocking all others:
"commandList": {
"type": "allow",
"commands": ["ps", "container*", "volume*"]
}
| Wildcard | Blocks/allows |
|---|---|
"container\*" | All "docker container ..." commands |
"image\*" | All "docker image ..." commands |
"volume\*" | All "docker volume ..." commands |
"network\*" | All "docker network ..." commands |
"build\*" | All "docker build ..." commands |
"system\*" | All "docker system ..." commands |
When a blocked command is executed:
/ # docker push myimage
Error response from daemon: enhanced container isolation: docker command "/v1.43/images/myimage/push?tag=latest" is blocked; if you wish to allow it, configure the docker socket command list in the Docker Desktop settings.
For Java/Python testing with Testcontainers:
"dockerSocketMount": {
"imageList": {
"images": [
"docker.io/testcontainers/ryuk:*",
"testcontainers/*:*"
]
},
"commandList": {
"type": "deny",
"commands": ["push", "build"]
}
}
For controlled CI/CD container management:
"dockerSocketMount": {
"imageList": {
"images": [
"docker:cli",
"your-registry.com/ci-tools/*:*"
]
},
"commandList": {
"type": "allow",
"commands": ["ps", "container*", "image*"]
}
}
For local development with Docker-in-Docker:
"dockerSocketMount": {
"imageList": {
"images": [
"docker:dind",
"docker:cli"
]
},
"commandList": {
"type": "deny",
"commands": ["system*"]
}
}
*) are convenient but less secure than specific tagspush and build$ docker image rm <image>
$ docker pull <image>
This resolves digest mismatches when upstream images are updated.