zoukankan      html  css  js  c++  java
  • 容器中使用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": [],
        }
      }
      ...
    }
    
  • 相关阅读:
    jTopo——js库
    node.js
    php 入门笔记
    D3 入门笔记
    webpack笔记
    React.js
    Grunt等前端自动化构建工具
    vue3.0的新特性
    electron-builder 打包流程
    vue里面如何下载图片,如何下载文件
  • 原文地址:https://www.cnblogs.com/styshoo/p/7690430.html
Copyright © 2011-2022 走看看