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

摘要:
此方法不起作用:ifconfigveth55d245edownbrctldelbrwveth55d245ecan'deleteBridgeveth55d45e:Operationnotallowed传输流量定义的其他接口.UPDATEroot@hostname~#uname-aLinuxhostname3.13.0-53-generic#89-UbuntuSMPWedMay2010:34:39UTC2015x86_64x86_64x86_64GNU/Linuxroot@hostname~#dockerinfoContainers:10Images:273StorageDriver:aufsRootDir:/var/lib/docker/aufsBackingFilesystem:extfsDirs:502Dirperm1Supported:false ExecutionDriver:native-0.2 LoggingDriver:json fileKernel版本:3.13.0-53-genericOperatingSystem:Ubuntu14.04.2LTSCPUs:8总内存:47.16GiBName:hostnameID:3SQM:44GG:77HJ:GBAU:2OWZ:C5CN:UWDV:JHRZ:LM7L:FJUN:AGUQ:HFALWARNING:Noswaplimitsupportroot@hostname~#DockserversionClientversion:1.7.1ClientAPIversion:11.19Government:go1.4.2Gitcommit:786b29dOS/Arch:linux/amd64Serverversion:11.7.1ServerAPIversion:1 1.19Government:go1.4.2Gitcommit:786b29dOS/Arch:linux/amd64有三个最佳答案:˃启动单个容器不应使系统上的兽医接口数量增加2,因为当Docker创建兽医对时,该对的一端在容器命名空间中被隔离,在主机中不可见。˃您似乎无法启动容器:Errorresponsefromdaemon:cannot startcontainer…˃Docker应该自动清理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. StorageDriver: aufs
  7. RootDir:/var/lib/docker/aufs
  8. BackingFilesystem: extfs
  9. Dirs:502
  10. Dirperm1Supported:false
  11. ExecutionDriver:native-0.2
  12. LoggingDriver: json-file
  13. KernelVersion:3.13.0-53-generic
  14. OperatingSystem:Ubuntu14.04.2 LTS
  15. CPUs:8
  16. TotalMemory:47.16GiB
  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接口也将删除其对等体)将是一件简单的事情.

免责声明:文章转载自《虚拟机多了个网卡用ethtool -i查看是veth驱动,是docker 惹得祸》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇PHP书写规范 PHP Coding Standardaxis1.4调用WebService报找不到分派方法下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

linux使用xampp安装MediaWiki环境

1、下载并安装xampp 下载xampp 在下载页面下载。 放置到相应目录 将xampp-linux-x64-5.6.3-0-installer.run文件复制到部署机器的/root目录下 安装 [root@vm-xa66bomoy2e ~]# cd /root [root@vm-xa66bomoy2e ~]# chmod +x xampp-linux-x...

RedHat7搭建KVM虚拟机

RedHat7搭建KVM虚拟机 1. 宿主机安装RedHat7.3系统 1.1选择语言 中文、简体中文(中国) 1.2安装位置 1.2.1自定义分区,选择LVM,将分区空间全部分配给根 1.2.2禁用Kdump 2.安装KVM 2.1安装前准备 2.1.1配置yum源 2.1.2防火墙处理 setenforce 0  sed -i 's/SELINUX=e...

docker中zookeeper集群的安装与使用 以及zookeeper集群对mysq集群的管理

未完待续 在zookeeper容器中 配置文件的位置 /conf/zoo.cfg bash-4.4# cd /conf/bash-4.4# pwd /conf bash-4.4# ls configuration.xsl log4j.properties zoo.cfg zoo_sample.cfg bash-4.4# ls -...

如何解决Linux 系统下 ifconfig 命令无网络接口 ens33

今天我在做Redis的哨兵集群模式的时候,以前都是好的,也不知道从什么时候开始就无法连接Redis服务器了,就是运行如下命令,没有效果:redis-server redis.conf,然后在通过命令查看redis的状态,始终没有启动Redis,命令如下:ps -ef|grep redis 或者 ps -ef|grep 6379 ,查询不到Redis服务器的...

docker+Nexus Repository Manager 搭建私有docker仓库

使用容器安装Nexus3 1.下载nexus3的镜像: docker pull sonatype/nexus3 2.使用镜像启动一个容器: docker run -d -p 8081:8081 -p 5000:5000 --name nexus3 -v /nexus-data:/nexus-data/ --restart=always sonatype/n...

关于远程调试

1.为什么要用远程调试? 1.本地环境与远程环境为不一致,线上线下数据的不一致,导致有些问题没办法在本地复现。仅靠本地调试无法直接定位问题。 2.本地调试一般有三种方法,一是写测试用例,二是在swagger上测试,需要造数据,比较麻烦。三是通过前端请求打到后端,但这种方法请求会随机打到本机和Dev环境的机器,需要禁用Dev的机器,有可能影响其他人开发。尤...