Skip to content

Instantly share code, notes, and snippets.

@doublenns
Last active October 18, 2019 06:08
Show Gist options
  • Save doublenns/38b01afc652f66e0e70a9acf99780fd8 to your computer and use it in GitHub Desktop.
Save doublenns/38b01afc652f66e0e70a9acf99780fd8 to your computer and use it in GitHub Desktop.
Get Internal IP of Docker container

Get IP Address of specific Container:

CN="<docker_container_name>"
CIP=$(sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CN)

Retrieve all container IDs and corresponding IP addresses:

sudo docker inspect -f '{{.Name}} - {{.NetworkSettings.IPAddress }}' $(sudo docker ps -aq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment