• 容器中使用iptables报错can't initialize iptables table Permission denied (you must be root)


    背景

      在docker容器中部署了一微服务,该服务需要docker push镜像到docker registry。因此,docker容器中需要安装docker服务。但在启动容器的时候,却报错:

    can't initialize iptables table `filter': Permission denied (you must be root)
    Perhaps iptables or your kernel needs to be upgraded.
    

    原因

      在容器中部署docker服务,而docker服务又会使用到iptables,因此在启动容器时,也会同时启动容器内的iptables。但iptables必须工作在容器的privileged模式下,否则就会如上报错。

    解决方法

      在启动容器时加上对应的privileged参数。

    docker中启动容器

    docker run -privileged [imageName]
    

    Marathon中启动容器

    {
      ...
      "instances": 1,
      "container": {
        "type": "DOCKER",
        "volumes": [],
        "docker": {
          "image": "imageName",
          "network": "BRIDGE", 
          "privileged": true,
          "parameters": [],
        }
      }
      ...
    }
    
  • 相关阅读:
    poj 2186 && hdu 3836
    poj 2833 The Average
    hud 3062 Party
    论 ACM 与泡妞 (转载)
    poj 1064 Cable master
    poj Candies
    [转]人才流失的背后
    获取存储过程的ReturnValue值
    javascript js jquery获取元素位置代码总结
    【引用】xmlpath 操作 xml
  • 原文地址:https://www.cnblogs.com/styshoo/p/7690430.html
Copyright © 2020-2023  润新知