Skip to content

Instantly share code, notes, and snippets.

@felipecwb
Created June 27, 2019 01:36
Show Gist options
  • Save felipecwb/24126d7b6dffd6bd611106fb7d532c1e to your computer and use it in GitHub Desktop.
Save felipecwb/24126d7b6dffd6bd611106fb7d532c1e to your computer and use it in GitHub Desktop.
How to change a IP route from proccess inside container
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