1. Docker compose
version: '3'
services:
postgresql:
container_name: postgresql
image: 'rapidfort/postgresql'
network:
nginx_net:
ipv4_address: x.x.x.x
volumes:
- type: bind
source: "/opt/postgresql-docker/bitnami-postgresql"
target: "/bitnami/postgresql"
- type: bind
source: "/opt/postgresql-docker/bitnami-postgresql/conf"
target: "/bitnami/postgresql/conf"
- type: bind
source: "/opt/postgresql-docker/init-db"
target: "/docker-entrypoint-initdb.d"
environment:
POSTGRESQL_PASSWORD: pswd
2. 从主机连接psql进行维护
docker run -it --rm --network compose-files_nginx_net rapidfort/postgresql:latest psql -h postgresql -U postgres
3. 注意事项
需要将绑定路径的所有者转换为1001:
chown -R 1001:1001 /opt/postgresql-docker/
标签:指南,opt,postgresql,source,PostgreSQL,Docker,bitnami,type,docker
From: https://www.cnblogs.com/gokoruri/p/17178778.html