方式一、
docker exec -u 0 -it <CONTAINER ID> bash
su postgres
psql -U <DBUSER> -W -d <DBNAME>
# 查看PGSQL默认服务
pstree
方式二、
docker run -it --rm --network docker_odoonetwork postgres psql -h pgsql -U odoo -d analogcircuit
docker-compose.yml
version: '2'
services:
web:
image: odoo:12.0
container_name: odoo
depends_on:
- db
ports:
- "8069:8069"
networks:
- "odoonetwork"
volumes:
- odoo-web-data:/var/lib/odoo
- ./config:/etc/odoo
- ./addons:/mnt/extra-addons
db:
image: postgres:10
container_name: pgsql
networks:
- "odoonetwork"
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- odoo-db-data:/var/lib/postgresql/data/pgdata
networks:
odoonetwork:
driver: bridge
volumes:
odoo-web-data:
odoo-db-data:
文章评论