Skip to content

Instantly share code, notes, and snippets.

@Zaffy
Last active July 26, 2018 10:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Zaffy/33444d07d0f55960eb5d2f0c03059fa4 to your computer and use it in GitHub Desktop.
Save Zaffy/33444d07d0f55960eb5d2f0c03059fa4 to your computer and use it in GitHub Desktop.
Docker: print ips and containers' names suitable for use in /etc/hosts
for i in `docker ps -a -q | awk '{print $1}'`; do echo $(docker inspect --format="{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" $i) $(docker ps | grep $i | awk '{print $NF}') ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment