blob: ff223ce427aad8ea95bcb9be04f38b5383c84d25 [file] [log] [blame]
Gabriel Oginski95875772022-07-08 07:46:32 +00001#!/bin/bash
2
3if [ "$1" == "" ]; then
4 echo "usage: $0 <container_name>"
5 echo "Exposes the netns of a docker container to the host"
6 exit 1
7fi
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"