Runc hook (OCI compatible) for setting up default bridge networking for containers.

Clone this repo:
  1. 30780f5 Bump version to v0.2.4 by Jess Frazelle · 8 days ago master v0.2.4
  2. be8f23c update travis releases by Jess Frazelle · 8 days ago
  3. 5814503 Bump version to v0.2.3 by Jess Frazelle · 8 days ago v0.2.3
  4. 5da84e3 simplify code by Jess Frazelle · 8 days ago
  5. 48a4544 Bump version to v0.2.2 by Jess Frazelle · 8 days ago v0.2.2

netns

Travis CI

Runc hook for setting up default bridge networking.

Installation

Binaries

Via Go

$ go get github.com/jessfraz/netns

Usage

$ netns --help
            _
 _ __   ___| |_ _ __  ___
| '_ \ / _ \ __| '_ \/ __|
| | | |  __/ |_| | | \__ \
|_| |_|\___|\__|_| |_|___/

 Runc hook for setting up default bridge networking.
 Version: v0.1.0

  -bridge string
        name for bridge (default "netns0")
  -d    run in debug mode
  -iface string
        name of interface in the namespace (default "eth0")
  -ip string
        ip address for bridge (default "172.19.0.1/16")
  -ipfile string
        file in which to save the containers ip address (default ".ip")
  -mtu int
        mtu for bridge (default 1500)
  -v    print version and exit (shorthand)
  -version
        print version and exit

Place this in the Hooks.Prestart field of your runc config.

{
    ...
    "hooks": {
        "prestart": [
            {
                "path": "/path/to/netns"
            }
        ]
    },
    ...
}

List network namespaces

$ sudo netns ls
IP                  LOCAL VETH          PID                 STATUS
172.19.0.3          netnsv0-21635       21635               running
172.19.0.4          netnsv0-21835       21835               running
172.19.0.5          netnsv0.2.494       22094               running
172.19.0.6          netnsv0-25996       25996               running