-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to get capabilities working in Docker swarm under Windows WSL2 #2893
Comments
I'm not able to reproduce this on a Linux machine;
Wondering if it's because the CLI is running on Windows; are you seeing the same problem if you use a Linux CLI on WSL2 ? |
Ah! I see the same issue when using Docker Desktop on Mac;
But if I deploy the stack using the "raw" socket (bypassing the API proxy that's used in Docker Desktop), it works; reproduction stepsStart a container with the docker 20.10.1 CLI in it, and with the docker run -it --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/run/docker.sock.raw:/var/run/docker.sock.raw \
docker:20.10.1 sh Inside the container, deploy the stack using the "regular" docker -H unix:///var/run/docker.sock stack deploy -c- through_proxy <<'EOF'
version: "3.9"
services:
haveged:
image: nginx:alpine
cap_add:
- NET_ADMIN
EOF Inspecting the service created through the API proxy, the capability is missing $ docker service inspect --format=pretty through_proxy_haveged
ID: yvkglw2pwh1gr7wujd2e2vf0y
Name: through_proxy_haveged
Labels:
com.docker.stack.image=nginx:alpine
com.docker.stack.namespace=through_proxy
Service Mode: Replicated
Replicas: 1
Placement:
UpdateConfig:
Parallelism: 1
On failure: pause
Monitoring Period: 5s
Max failure ratio: 0
Update order: stop-first
RollbackConfig:
Parallelism: 1
On failure: pause
Monitoring Period: 5s
Max failure ratio: 0
Rollback order: stop-first
ContainerSpec:
Image: nginx:alpine@sha256:c2ce58e024275728b00a554ac25628af25c54782865b3487b11c21cafb7fabda
Resources:
Networks: through_proxy_default
Endpoint Mode: vip Deploying the stack, but this time using the "raw" socket; docker -H unix:///var/run/docker.sock.raw stack deploy -c- without_proxy <<'EOF'
version: "3.9"
services:
haveged:
image: nginx:alpine
cap_add:
- NET_ADMIN
EOF Inspecting the service shows that this time the capabilities are set: $ docker service inspect --format=pretty without_proxy_haveged
ID: yg8ve22zmrsheu257uuvjigm3
Name: without_proxy_haveged
Labels:
com.docker.stack.image=nginx:alpine
com.docker.stack.namespace=without_proxy
Service Mode: Replicated
Replicas: 1
Placement:
UpdateConfig:
Parallelism: 1
On failure: pause
Monitoring Period: 5s
Max failure ratio: 0
Update order: stop-first
RollbackConfig:
Parallelism: 1
On failure: pause
Monitoring Period: 5s
Max failure ratio: 0
Rollback order: stop-first
ContainerSpec:
Image: nginx:alpine@sha256:c2ce58e024275728b00a554ac25628af25c54782865b3487b11c21cafb7fabda
Capabilities:
Add: CAP_NET_ADMIN
Resources:
Networks: without_proxy_default
Endpoint Mode: vip So looks like this is a bug in the Docker Desktop API not passing through the new options for API v1.41 |
Maybe see if moby/moby#32957 (comment) is similar. Since it's a Windows specific issue and does not occur with a Linux client. |
Is there any documentation on what the API proxy does? Why can't we just call the socket directly? |
The proxy is used for various things, e.g., when bind-mounting files from the host, the proxy takes care of rewriting paths from the host to their equivalent locations in the Linux VM, as well as setting up monitoring for those paths. I think there's additional things (remapping IP-addresses "inside" vs "outside" of the VM etc.) So, while the |
I'm seeing similar behaviour with Docker 20.10.1, build 831ebea (docker-ce/buster,now 5:20.10.1 Capabilities are successfully applied when using |
Yes, that sounds like an issue with portainer; may be that they didn't update their API integration yet for the latest API changes in Docker 20.10.x |
Also short update on the above; the Docker Desktop team informed me that a fix for this was merged, but may not yet have been released due to Christmas and New Year; I'm asking them which release of Docker Desktop the fix will be in 👍 |
Looks to be fixed (tested on Docker Desktop for Mac 3.2.2), using the reproduction steps from #2893 (comment) docker stack deploy -c- through_proxy <<'EOF'
version: "3.9"
services:
haveged:
image: nginx:alpine
cap_add:
- NET_ADMIN
EOF Check if the capabilities were set on the service: docker service inspect --format=pretty through_proxy_haveged | grep -1 Capabilities
Image: nginx:alpine@sha256:e20c21e530f914fb6a95a755924b1cbf71f039372e94ac5ddcf8c3b386a44615
Capabilities:
Add: CAP_NET_ADMIN |
I am trying to test the capabilities feature specified in #2687
docker stack deploy -c havege.yml havege
Expected behavior
I expected to see
NET_ADMIN
or some sort of capabilityActual behavior
No capabilities shown.
Information
Steps to reproduce the behavior
havege.yml
fileOriginally in docker/for-win#9853
The text was updated successfully, but these errors were encountered: