jpetazzo / pipework

Software-Defined Networking tools for LXC (LinuX Containers)
Apache License 2.0
4.22k stars 727 forks source link

Open vSwitch bridged interfaces are not deleted after container stop #143

Closed Dmitriusan closed 9 years ago

Dmitriusan commented 9 years ago

Ubuntu 14.04, docker 1.6.1, ovs-vsctl (Open vSwitch) 2.0.2 Steps to reproduce:

# pipework ovs-int $(docker run -d -p 8080:8080 satnam6502/go-webserver-helloworld 
/gopath/src/github.com/satnam6502/go-webserver-helloworld/hello) dhcp 0a:d0:cc:e0:02:01
# docker ps
CONTAINER ID        IMAGE                                       COMMAND                CREATED              STATUS              PORTS                    NAMES
084bd6d0b240        satnam6502/go-webserver-helloworld:latest   "/gopath/src/github.   About a minute ago   Up About a minute   0.0.0.0:8080->8080/tcp   insane_mccarthy   
# docker stop 084bd6d0b240
# ovs-vsctl show
    Bridge ovs-int
        Port "veth1pl6217"
            Interface "veth1pl6217"
        Port ovs-int
            Interface ovs-int
                type: internal

Expected result: Virtual interface should be unbridged & deleted after container stop as stated at documentation

jpetazzo commented 9 years ago

Hi! Thanks for reporting this. Unfortunately, I don't have an OVS setup to reproduce this here :(

Could you also attach the output of docker inspect for this container?

Dmitriusan commented 9 years ago

docker inspect a0ab9c643513

[{
    "AppArmorProfile": "",
    "Args": [],
    "Config": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": [
            "/gopath/src/github.com/satnam6502/go-webserver-helloworld/hello"
        ],
        "CpuShares": 0,
        "Cpuset": "",
        "Domainname": "",
        "Entrypoint": null,
        "Env": [
            "HOME=/",
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/goroot/bin:/gopath/bin",
            "DEBIAN_FRONTEND=noninteractive",
            "GOROOT=/goroot",
            "GOPATH=/gopath"
        ],
        "ExposedPorts": {
            "8080/tcp": {}
        },
        "Hostname": "a0ab9c643513",
        "Image": "satnam6502/go-webserver-helloworld",
        "Labels": {},
        "MacAddress": "",
        "Memory": 0,
        "MemorySwap": 0,
        "NetworkDisabled": false,
        "OnBuild": null,
        "OpenStdin": false,
        "PortSpecs": null,
        "StdinOnce": false,
        "Tty": false,
        "User": "",
        "Volumes": null,
        "WorkingDir": ""
    },
    "Created": "2015-06-16T09:16:06.253802302Z",
    "Driver": "aufs",
    "ExecDriver": "native-0.2",
    "ExecIDs": null,
    "HostConfig": {
        "Binds": null,
        "CapAdd": null,
        "CapDrop": null,
        "CgroupParent": "",
        "ContainerIDFile": "",
        "CpuShares": 0,
        "CpusetCpus": "",
        "Devices": [],
        "Dns": null,
        "DnsSearch": null,
        "ExtraHosts": null,
        "IpcMode": "",
        "Links": null,
        "LogConfig": {
            "Config": null,
            "Type": "json-file"
        },
        "LxcConf": [],
        "Memory": 0,
        "MemorySwap": 0,
        "NetworkMode": "bridge",
        "PidMode": "",
        "PortBindings": {
            "8080/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "8080"
                }
            ]
        },
        "Privileged": false,
        "PublishAllPorts": false,
        "ReadonlyRootfs": false,
        "RestartPolicy": {
            "MaximumRetryCount": 0,
            "Name": "no"
        },
        "SecurityOpt": null,
        "Ulimits": null,
        "VolumesFrom": null
    },
    "HostnamePath": "/media/vconts/docker/containers/a0ab9c643513553b4149fb48e40d6a4d9da4b8b52224c6bbf5f823bec5cd77d3/hostname",
    "HostsPath": "/media/vconts/docker/containers/a0ab9c643513553b4149fb48e40d6a4d9da4b8b52224c6bbf5f823bec5cd77d3/hosts",
    "Id": "a0ab9c643513553b4149fb48e40d6a4d9da4b8b52224c6bbf5f823bec5cd77d3",
    "Image": "f01bb1047dd12a0c4ec25b98923289c246c07fa9ed0478014e06e869c8542cdd",
    "LogPath": "/media/vconts/docker/containers/a0ab9c643513553b4149fb48e40d6a4d9da4b8b52224c6bbf5f823bec5cd77d3/a0ab9c643513553b4149fb48e40d6a4d9da4b8b52224c6bbf5f823bec5cd77d3-json.log",
    "MountLabel": "",
    "Name": "/drunk_franklin",
    "NetworkSettings": {
        "Bridge": "",
        "Gateway": "",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "IPAddress": "",
        "IPPrefixLen": 0,
        "IPv6Gateway": "",
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "MacAddress": "",
        "PortMapping": null,
        "Ports": null
    },
    "Path": "/gopath/src/github.com/satnam6502/go-webserver-helloworld/hello",
    "ProcessLabel": "",
    "ResolvConfPath": "/media/vconts/docker/containers/a0ab9c643513553b4149fb48e40d6a4d9da4b8b52224c6bbf5f823bec5cd77d3/resolv.conf",
    "RestartCount": 0,
    "State": {
        "Dead": false,
        "Error": "",
        "ExitCode": 2,
        "FinishedAt": "2015-06-16T09:16:33.017358979Z",
        "OOMKilled": false,
        "Paused": false,
        "Pid": 0,
        "Restarting": false,
        "Running": false,
        "StartedAt": "2015-06-16T09:16:06.516538418Z"
    },
    "Volumes": {},
    "VolumesRW": {}
}
]
jpetazzo commented 9 years ago

I finally got to reproduce this!

It looks like it's a normal behavior of OVS; when a port is deleted, it remains in the database and it still shows up. It doesn't seem to be related to pipework. If someone has an idea about how to change this, let me know!

But meanwhile I'll close this issue.

Thank you!