pgAdmin on Docker/Ubuntu 18


pgAdmin is a web based admin tool for Postgresql which can be found here: It is a useful tool for people (read me) who can’t always remember the psql syntax when troubleshooting a database.

This post will quickly show how to set up an Ubuntu 18 in a virtual machine, install Docker and set up pgAdmin with a persistend volume. If you are already familiar with Vagrant Kitchen (my take on integrating Vagrant with an ansible inventory), you should be able to do this in about 5 - 10 minutes.

Featured image


The installation is divided into two steps:

  • On your laptop/workstation
  • In the new Ubuntu 18 VM

On your laptop/workstation

Create a Vagrant kitchen inventory. You need to have vagrant kitchen set up before you start this. See:

pgadmin ansible_ssh_host= vagrant_image=kmggroup/soe-linux-u18  vagrant_ram=2048 vagrant_cpu=4 ansible_user=vagrant ansible_password=vagrant
  • Start the VM - on your workstation (should take about one minute)
vagrant up pgadmin

In the new Ubuntu 18 VM

When the VM is started, connect to it:

vagrant ssh pgadmin
  • Install docker CE (community edition) (takes about 1.5 minutes)
sudo apt-get update
sudo apt-get install  -y   apt-transport-https     ca-certificates     curl     gnupg-agent     software-properties-common
curl -fsSL | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository    "deb [arch=amd64] \
   $(lsb_release -cs) \
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli
  • Create a config file for the docker container
cat<<EOT > pgadmin-env.list
  • Fetch and start pgAdmin (takes about 1.5 minutes)
sudo docker pull dpage/pgadmin4
sudo docker volume create --driver local --name=pga4volume
sudo docker run -p 80:80 --env-file=pgadmin-env.list --volume=pga4volume:/var/lib/pgadmin dpage/pgadmin4

You can now visit the pgAdmin GUI on your newly installed docker image on (see IP address in your vagrant-kitchen inventory).

Featured image