Skip to content

Instantly share code, notes, and snippets.



Last active Nov 24, 2018
What would you like to do?
Get IP of running docker container

Get docker container IP address by name


mkdir -p $HOME/bin
wget -O ~/bin/docker-container-ip
chmod +x ~/bin/docker-container-ip

Troubleshooting: You may additionally need to run the following command to ensure the script is available in your path. Additionally you need write-permissions for your $HOME folder

export PATH=$PATH:$HOME/bin


docker-container-ip {container-name}
if [[ $# -lt 1 ]]; then
echo "Must provide a name"
exit 1
# uses
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment