7👍
✅
To access postgres in the container, run the cli in the scope of the container
docker-compose run postgres psql
You can also connect to the containers published port, which hasn’t been published in your existing config.
postgres:
build:
context: .
dockerfile: ./compose/production/postgres/Dockerfile
volumes:
- postgres_data_local:/var/lib/postgresql/data
- postgres_backup_local:/backups
ports:
- '5433:5432'
environment:
- POSTGRES_USER=vicki
Then connect to your published port
psql -h localhost -p 5433
👤Matt
Source:stackexchange.com