Skip to content

Instantly share code, notes, and snippets.

@breiter
Last active February 27, 2025 17:30
Show Gist options
  • Save breiter/30fc9ac1263df84b164d568c267034e3 to your computer and use it in GitHub Desktop.
Save breiter/30fc9ac1263df84b164d568c267034e3 to your computer and use it in GitHub Desktop.
pgadmin4 local docker
#!/bin/sh
# change to your email
[email protected]
PASSWORD=password
# note that the hostname of postgres database running on the same docker host is
# host.docker.internal
docker run --rm --pull always \
-e "PGADMIN_DEFAULT_EMAIL=${EMAIL}" \
-e "PGADMIN_DEFAULT_PASSWORD=${PASSWORD}" \
-p 5050:80 \
--name pgadmin4 \
--volume pgadmin4-vol:/var/lib/pgadmin \
--detach dpage/pgadmin4 \
|| exit
until curl --output /dev/null --silent --head --fail http://localhost:5050; do
printf '.'
sleep 1
done
printf "\npgadmin4 is listening on http://localhost:5050/\nstarting browser\n"
OPEN=""
case $(uname -s) in
Linux*)
OPEN=xdg-open
;;
Darwin*)
OPEN=open
;;
*)
OPEN=start #assume windows
;;
esac
$OPEN http://localhost:5050/
#!/bin/sh
docker stop pgadmin4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment