Erect a SQL playground with docker compose

Friday, March 20, 2020

Docker Compose

Modify this docker-compose.yml on your need.

version: '3.0'
services: 
  db:
    image: postgres:12.2-alpine
    restart: always
    volumes:
      - ./.persistence/db:/var/lib/postgresql/data
    environment: 
      - POSTGRES_USER=kowalski # optional, "postgres" will be taken by default 
      - POSTGRES_PASSWORD=114514 # modify it
    
  dashboard:
    image: dpage/pgadmin4:latest
    restart: always
    volumes: 
      - ./.persistence/dashboard:/var/lib/pgadmin
    environment: 
      - PGADMIN_DEFAULT_EMAIL=kowalski@local.domain # modify it
      - PGADMIN_DEFAULT_PASSWORD=114514 # modify it
    ports:
      - 80:80
    depends_on: 
      - db

Persistence

./.persistence will be mounted for data persistence.

pgAdmin runs as the pgadmin user (UID: 5050) in the pgadmin group (GID: 5050) in the container. You must ensure that all files are readable, and where necessary writeable for this user on the host machine. Run:

sudo chown -R 5050:5050 ./.persistence

pgAdmin

  • Run docker-compose up

  • Access localhost in your browser then log into pgAdmin4 panel.

  • Create a server, use db as hostname, 5432 as port

dockerdb
CC BY 4.0

Tower of Hanoi problem

0x04 A glance into the kernel: turnstile

comments powered by Disqus