Skip to content

Instantly share code, notes, and snippets.

@ynwd
Last active January 4, 2024 22:38
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ynwd/f39c78fc4c62b0116425f333be2b9f77 to your computer and use it in GitHub Desktop.
Save ynwd/f39c78fc4c62b0116425f333be2b9f77 to your computer and use it in GitHub Desktop.
postgres uuid extension in docker-compose
  1. create docker-compose.yml file
  2. create database/postgres/docker-entrypoint-initdb folder
  3. create database/postgres/docker-entrypoint-initdb/extension.sql file

Clear Cache

docker-compose rm -fv db
version: "3.8"
services:
redis:
image: "redis:alpine"
ports:
- '6379:6379'
db:
image: postgres:12.2
environment:
POSTGRES_DB: postgres
POSTGRES_USER: admin
POSTGRES_PASSWORD: secret
volumes:
- ./database/postgres/docker-entrypoint-initdb:/docker-entrypoint-initdb.d/
ports:
- "5432:5432"
adminer:
image: adminer
restart: always
ports:
- 8080:8080
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment