PGAdminをdocker-compose.ymlに設置
# ...
services:
# ...
pgadmin:
image: dpage/pgadmin4
ports:
- "8432:80"
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: AdminSuperSecret
yaml
psql 機能を有効化したい場合 (本来はbuildを利用した方が良いだろうが、より少ない手数で有効化にする場合)
# ...
services:
# ...
pgadmin:
image: dpage/pgadmin4
ports:
- "8432:80"
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: AdminSuperSecret
user: root
entrypoint: ["sh", "-ec", "echo 'ENABLE_PSQL = True' >> /pgadmin4/config.py; sudo -u pgadmin /entrypoint.sh"]
yaml
+ストレージ永続化
# ...
services:
pgadmin:
image: dpage/pgadmin4
ports:
- "8432:80"
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: AdminSuperSecret
user: root
entrypoint: ["sh", "-ec", "echo 'ENABLE_PSQL = True' >> /pgadmin4/config.py; sudo -u pgadmin /entrypoint.sh"]
volume:
- pgadmin-data:/var/lib/pgadmin/
# ...
volumes:
# ...
pgadmin-data:
yaml
+PostgreSQL本体
version: "3"
services:
pg:
image: postgres:14.5
ports:
- "9432:5432"
environment:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_PASSWORD: 'psqlAdminPassword'
volumes:
- pg-data:/var/lib/postgresql/data
pgadmin:
image: dpage/pgadmin4
ports:
- "8432:80"
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: AdminSuperSecret
user: root
entrypoint: ["sh", "-ec", "echo 'ENABLE_PSQL = True' >> /pgadmin4/config.py; sudo -u pgadmin /entrypoint.sh"]
volume:
- pgadmin-data:/var/lib/pgadmin/
volumes:
pg-data:
pgadmin-data:
yaml