summaryrefslogtreecommitdiffstats
path: root/extras/strongswan/vpp_sswan/docker/exposedockernetns.sh
blob: ff223ce427aad8ea95bcb9be04f38b5383c84d25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

if [ "$1" == "" ]; then
        echo "usage: $0 <container_name>"
        echo "Exposes the netns of a docker container to the host"
        exit 1
fi

        pid=`docker inspect -f '{{.State.Pid}}' $1`
        ln -s /proc/$pid/ns/net /var/run/netns/$1

        echo "netns of ${1} exposed as /var/run/netns/${1}"

        #echo "try: ip netns exec ${1} ip addr list"