首页 > 解决方案 > RTNETLINK answers: Operation not permitted - Docker Swarm

问题描述

I'm running a docker swarm using docker compose

and I'm trying to run tc in my script however it returns

RTNETLINK answers: Operation not permitted

I double checked it and it seems I have to add some flags to my docker compose file.

I tried already adding

privileged: true

Which made no difference

and

    securityContext:
      privileged: true
      capabilities:
        add: ["NET_ADMIN","NET_RAW"]

Which errored on starting up the swarm, I assume this is for kubernetes only.

Same for this option:

    cap_add:
      - NET_ADMIN

How can I fix this issue?

标签: dockerdocker-composedocker-swarm

解决方案


    cap_add:
      - NET_ADMIN

已添加到最新的 docker 版本中,并且可以与版本:20.10.5 一起正常工作。

至少在 Ubuntu 20 上,我必须使用 docker doc 中提供的安装脚本手动更新到 stable 分支


推荐阅读