How to identify orphaned veth interfaces and how to delete them?
Fixed by upgrade docker to last version. New version:
root@hostname ~ # docker version
Client:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 02:35:49 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 02:35:49 UTC 2015
OS/Arch: linux/amd64
Now interfaces remove together with containers. Old orphaned interfaces were deleted manually by following command:
# ip link delete <ifname>
There are three problems here:
Starting a single container should not increase the count of
veth
interfaces on your system by 2, because when Docker creates aveth
pair, one end of the pair is isolated in the container namespace and is not visible from the host.It looks like you're not able to start a container:
Error response from daemon: Cannot start container ...
Docker should be cleaning up the
veth
interfaces automatically.
These facts make me suspect that there is something fundamentally wrong in your environment. Can you update your question with details about what distribution you're using, which kernel version, and which Docker version?
How I can identify which interfaces are linked with existing containers, and how I can remove extra interface which was linked with removed contrainers?
With respect to manually deleting veth
interfaces: A veth
interface isn't a bridge, so of course you can't delete one with brctl
.
To delete a veth
interface:
# ip link delete <ifname>
Detecting "idle" interfaces is a thornier problem, because if you just look at traffic you're liable to accidentally delete something that was still in use but that just wasn't seeing much activity.
I think what you would actually want to look for are veth
interfaces whose peer is also visible in the global network namespace. You can find the peer of a veth
interface using these instructions, and then it would be a simple matter of seeing if that interface is visible, and then deleting one or the other (deleting a veth
interface will also remove its peer).