0

I am trying to start docker container on the rockpix node with cap_add and device options but docker stack errors saying

$ docker stack deploy -c docker-stack.yml vpnproxy
services.vpn_proxy.deploy Additional property cap_add is not allowed
$ docker stack deploy -c docker-stack.yml vpnproxy
services.vpn_proxy.deploy Additional property device is not allowed

Below is my stack file.

version: "3.9"
services:

  vpn_proxy:
    image: ciasto/alpine-myvpn-proxy:v1
    volumes:
      - /etc/openvpn:/etc/openvpn
      - /etc/haproxy:/etc/haproxy
    networks:
      - vpn_proxy_frontend
    deploy:
      replicas: 1
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: on-failure
      cap_add: NET_ADMIN
      device: /dev/net/tun
      placement:
        constraints:
          - "node.hostname==rockpix"

networks:
  vpn_proxy_frontend:

What am I doing wrong ?

0

You're not doing anything wrong, cap_add and devices are ignored when deploying a stack in Swarm mode. See the Notes section of the following links:

https://docs.docker.com/compose/compose-file/compose-file-v3/#cap_add-cap_drop https://docs.docker.com/compose/compose-file/compose-file-v3/#devices

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.