Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Docker Compose para postgresql
version: "3"
services:
# Create a service named db.
db:
# Use the Docker Image postgres. This will pull the newest release.
image: "postgres"
# Give the container the name my_postgres. You can changes to something else.
container_name: "demo_uno_postgres"
# Setup the username, password, and database name. You can changes these values.
environment:
- POSTGRES_USER=u_demo
- POSTGRES_PASSWORD=pwd0123456789
- POSTGRES_DB=db_demo_uno
# Maps port 54320 (localhost) to port 5432 on the container. You can change the ports to fix your needs.
ports:
- "5432:5432"
# Set a volume some that database is not lost after shutting down the container.
# I used the name postgres-data but you can changed it to something else.
volumes:
- ./postgres-data:/var/lib/postgresql/data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.