Created
May 11, 2015 10:10
-
-
Save fabiand/04b41c0a9fb24c023297 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker-pid() { docker inspect --format="{{.State.Pid}}" $1 ; } | |
DSTCT=${1} | |
DSTPID=$(docker-pid $DSTCT) | |
UNCONNECTEDETH=$(nmcli -t -f device,type,connection device | egrep "ethernet:--$" | cut -d ":" -f1) | |
for NIC in $UNCONNECTEDETH | |
do | |
echo "Moving '$NIC' to netns of '$DSTPID'" | |
ip link set netns ${DSTPID} $NIC | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment