• 虚拟机多了个网卡用ethtool -i查看是veth驱动,是docker 惹得祸


    当我通过docker run启动任何容器时,我们得到一个新的veth interface.删除容器后,应删除与容器链接的veth接口.但是,有时它会失败(然后容器启动出错):

    1. root@hostname /home # ifconfig | grep veth | wc -l
    2. 53
    3. root@hostname /home # docker run -d -P axibase/atsd -name axibase-atsd-
    4. 28381035d1ae2800dea51474c4dee9525f56c2347b1583f56131d8a23451a84e
    5. Error response from daemon: Cannot start container 28381035d1ae2800dea51474c4dee9525f56c2347b1583f56131d8a23451a84e: iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 33359 -j DNAT --to-destination 172.17.2.136:8883 ! -i docker0: iptables: No chain/target/match by that name.
    6. (exit status 1)
    7. root@hostname /home # ifconfig | grep veth | wc -l
    8. 55
    9. root@hostname /home # docker rm -f 2838
    10. 2838
    11. root@hostname /home # ifconfig | grep veth | wc -l
    12. 55

    我如何识别哪些接口与现有容器链接,以及如何删除与已删除的对手链接的额外接口?

    这种方式不起作用(通过root):

    1. ifconfig veth55d245e down
    2. brctl delbr veth55d245e
    3. can't delete bridge veth55d245e: Operation not permitted

    现在由传输流量定义的额外接口(如果没有活动,则是额外接口).

    UPDATE

    1. root@hostname ~ # uname -a
    2. Linux hostname 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    3. root@hostname ~ # docker info
    4. Containers: 10
    5. Images: 273
    6. Storage Driver: aufs
    7. Root Dir: /var/lib/docker/aufs
    8. Backing Filesystem: extfs
    9. Dirs: 502
    10. Dirperm1 Supported: false
    11. Execution Driver: native-0.2
    12. Logging Driver: json-file
    13. Kernel Version: 3.13.0-53-generic
    14. Operating System: Ubuntu 14.04.2 LTS
    15. CPUs: 8
    16. Total Memory: 47.16 GiB
    17. Name: hostname
    18. ID: 3SQM:44OG:77HJ:GBAU:2OWZ:C5CN:UWDV:JHRZ:LM7L:FJUN:AGUQ:HFAL
    19. WARNING: No swap limit support
    20. root@hostname ~ # docker version
    21. Client version: 1.7.1
    22. Client API version: 1.19
    23. Go version (client): go1.4.2
    24. Git commit (client): 786b29d
    25. OS/Arch (client): linux/amd64
    26. Server version: 1.7.1
    27. Server API version: 1.19
    28. Go version (server): go1.4.2
    29. Git commit (server): 786b29d
    30. OS/Arch (server): linux/amd64
    最佳答案
    这里有三个问题:

    >启动单个容器不应该将系统上的veth接口数增加2,因为当Docker创建一个veth对时,该对的一端在容器命名空间中被隔离,并且在主机中不可见.
    >看起来你无法启动容器:

    1. Error response from daemon: Cannot start container ...

    > Docker应该自动清理veth接口.

    这些事实让我怀疑你的环境中存在根本性的错误.您能否更新您的问题,详细说明您正在使用的分发版,哪个内核版本以及哪个Docker版本?

    How I can identify which interfaces are linked with existing containers,and how I can remove extra interface which was linked with removed contrainers?

    关于手动删除veth接口:veth接口不是桥接器,所以当然你不能用brctl删除它.

    要删除veth接口:

    1. # ip link delete <ifname> <="" code="">

    检测“空闲”接口是一个棘手的问题,因为如果你只是看流量,你可能会意外删除仍在使用但没有看到太多活动的东西.

    我认为你真正想要寻找的是veth接口,其对等体在全局网络命名空间中也是可见的.您可以使用these instructions找到veth接口的对等体,然后查看该接口是否可见,然后删除其中一个(删除veth接口也将删除其对等体)将是一件简单的事情.

  • 相关阅读:
    使用iText 7读取PDF文件中的文本和图片
    登记或取消登记盈亏库存日记账行数量
    uni-app(未完)
    javaScript的基本优雅写法
    ModuleFederation-模块联邦
    typescript
    img标签src图片路径根目录问题
    开源工具分享
    软件缺陷的度量、分析和统计
    MIT6.824 2020 Lab2 A Raft Leader Election
  • 原文地址:https://www.cnblogs.com/fpcbk/p/13801842.html
Copyright © 2020-2023  润新知