Gabriel Oginski | 9587577 | 2022-07-08 07:46:32 +0000 | [diff] [blame] | 1 | #!/bin/bash |
2 | |||||
3 | if [ "$1" == "" ]; then | ||||
4 | echo "usage: $0 <container_name>" | ||||
5 | echo "Exposes the netns of a docker container to the host" | ||||
6 | exit 1 | ||||
7 | fi | ||||
8 | |||||
9 | pid=`docker inspect -f '{{.State.Pid}}' $1` | ||||
10 | ln -s /proc/$pid/ns/net /var/run/netns/$1 | ||||
11 | |||||
12 | echo "netns of ${1} exposed as /var/run/netns/${1}" | ||||
13 | |||||
14 | #echo "try: ip netns exec ${1} ip addr list" |