Skip to content

Instantly share code, notes, and snippets.

@swyngaard
Last active February 21, 2017 14:55
Show Gist options
  • Save swyngaard/2f18c9f27e5847e59e5ee614236ddd44 to your computer and use it in GitHub Desktop.
Save swyngaard/2f18c9f27e5847e59e5ee614236ddd44 to your computer and use it in GitHub Desktop.
Docker get IP address of running container

Install JSON reader:

sudo aptitude install jq

Start the container. Get the IP address as follows:

docker inspect container_name | jq -r '.[].NetworkSettings.IPAddress'
#!/bin/bash
docker inspect $1 | jq -r '.[].NetworkSettings.IPAddress'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment