GitHunt
MI

mickelindahl/docker_pgadmin4

Docker pgadmin4

Docker compose script for creating container runnning
pgAdmin 4

Installation

Run cp sample.config_local.py config_local.py.

Now open config_local.py

Set DEFAULT_SERVER. E.g. DEFAULT_SERVER=localhost for running on your local machine
or DEFAULT_SERVER=domain.se if running on a server with domain.

If running as a web server yoo also need to configure the mail settings such that
you can have user login.

MAIL_SERVER = 'smtp.mailgun.org'
MAIL_PORT = 25
MAIL_USE_SSL = True
MAIL_USERNAME = 'postmaster@domain.se'
MAIL_PASSWORD = '123'

If running locally disable user login

SERVER_MODE = False

Run cp sample.docker-compose.yml docker.compose.yml and open docker-compose.yml and set a username and password`

Run docker-compose build && docker-compose up -d

Done!!

Enter conainer

docker exec -it pgadmin4 /bin/sh

Cnnnect to localhost

Run sudo ip addr show docker0

The IP adress shown is the one docker has given your computer (the host)
(source).

Drop connections

If you can not delete a database because there are existing connectins you can use the following
code to drop all connections except your own.

SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE datname = current_database()
  AND pid <> pg_backend_pid();

Also restart postgres sudo service postgresql restart

Languages

Shell100.0%

Contributors

Created January 6, 2017
Updated June 1, 2023
mickelindahl/docker_pgadmin4 | GitHunt