Search code examples
macospostgresqldockerpgadmin

Running docker with pgadmin on mac getting Error: Unable to initialize GTK+, is DISPLAY set properly?


I am trying to run pgadmin from my mac (Sierra 10.12.4) as described here

docker run --rm --name pgadmin --link postgres:postgres -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY mdouchement/pgadmin3:1.20.0

but I am getting this error:

Error: Unable to initialize GTK+, is DISPLAY set properly?

how can I run docker pgadmin ?


Solution

  • Containers don't have a windows manager, so if you want to run GUI applications you need (e.g.) XQuartz / X11 on your Mac and have the container attach to this. This is a bit tricky, and may, or may not work. A longer discussion with hint to get this working, can be found in the Docker issue tracker; https://github.com/docker/docker/issues/8710

    However, pgAdmin 4 has an option to run through a webserver, which makes it better suitable for running in a container. I created a (very simple/minimal) pgAdmin image that can be run on Docker; https://hub.docker.com/r/thajeztah/pgadmin4/, and allows you to access pgAdmin by publishing port 5050 (note the default configuration does not have access control / password protection enabled, so be sure you don't publish the port on a publicly accessible host)