Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Created September 26, 2019 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasG77/bd2c1ae9930923f76aa06a4c1b05988d to your computer and use it in GitHub Desktop.
Save ThomasG77/bd2c1ae9930923f76aa06a4c1b05988d to your computer and use it in GitHub Desktop.
Docker/Docker-compose recipes

Docker-compose recipes

Get IP for PostgreSQL docker image

# Filter docker image running with port 5432 to get IP to use for Pgadmin connexion
# Get the key of the inspected network (one in our case) from this image using docker inspect
# Provide the key to access to the IP of the docker container with DB
# Copy/paste to use in PgAdmin (PS: we use a local docker running with postgres user but passwordless)
key=`docker inspect $(docker-compose ps |grep 5432 |cut -d ' ' -f1) |jq '.[].NetworkSettings.Networks|keys[]'` \
docker inspect $(docker-compose ps |grep 5432 |cut -d ' ' -f1) |jq -r .[].NetworkSettings.Networks.${key}.IPAddress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment