Created
June 27, 2019 01:36
-
-
Save felipecwb/24126d7b6dffd6bd611106fb7d532c1e to your computer and use it in GitHub Desktop.
How to change a IP route from proccess inside container
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 inspect -f '{{.State.Pid}}' my-container | |
pid=$(docker inspect -f '{{.State.Pid}}' my-container) | |
echo $pid | |
mkdir -p /var/run/netns | |
ln -s /proc/$pid/ns/net /var/run/netns/$pid | |
ip netns exec $pid ip route del default | |
docker network inspect my-network | |
ip netns exec $pid ip route add default via 172.16.238.1 | |
docker exec -it my-container sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment