Docker compose example with postgreSQL:
version: "3"
services:
# Postgres
postgres:
image: postgres:latest
ports:
# Accessible from the host at port :35432
- "35432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: saas
# Make sure log colors show up correctly
tty: true
Connect to your container from the host:
docker exec -it myproject_pg_container_name /bin/bash
Then, from the container:
root@d14c082e80c8:/# psql -U postgres