Saltar al contenido

Docker Compose para PostgreSQL

Hoy comparto la receta para poder levantar una base de datos PostgreSQL en Docker Compose.

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
view raw docker-compose.yml hosted with ❤ by GitHub

Link Docker con PostgreSQL.

Publicado enBlog
× ¿Cómo puedo ayudarte?