0
In the
Docker Networking Cookbook (I got my copy directly from
Pact Publishing),
Jon Langemak explains why the
iproute2 utilities can't see Docker's network namespaces: Docker creates its namespace objects in
/var/run/docker/netns, but
iproute2 expects to find them in
/var/run/netns.
Creating a symlink from
/var/run/docker/netns to
/var/run/netns is the obvious solution:
$ sudo ls -l /var/run/docker/netns
total 0
-r--r--r--. 1 root root 0 Feb 1 11:16 1-6ledhvw0x2
-r--r--r--. 1 root root 0 Feb 1 11:16 ingress_sbox
$ sudo ip netns list
$ sudo ln -s /var/run/docker/netns /var/run/netns
$ sudo ip netns list
1-6ledhvw0x2 (id: 0)
ingress_sbox (id: 1)
$
But there's a problem. Look where this stuff is mounted:
$ ls -l /var/run
lrwxrwxrwx. 1 root root 6 Jan 26 20:22 /var/run -> ../run
$ df -k /run
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 16381984 16692 16365292 1% /run
$
The symlink won't survive a reboot because it lives in a memory-backed filesystem. My first instinct was to have a boot script (say
/etc/rc.d/rc.local) create the symlink, but there's a much better way.
Fine, I'm starting to like systemdSystemd's
tmpfiles.d is a really elegant way of handling touch files, symlinks, empty
Continue reading