Docker compose files 🐳


I’ve compiled a couple of Docker Compose files that I frequently work with and find useful. Instead of referring back to documentation or searching for examples, I’ve gathered these files in one place for easy access. It might help you too.

PostgreSQL database with adminer:

version: "3.9"

services:
  db:
    image: postgres:latest
    container_name: the-container-name
    restart: always
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: example_password
      POSTGRES_DB: your-database-name
    ports:
      - "5432:5432"
    volumes:
      - ./data:/var/lib/postgresql/data

  adminer:
    image: adminer
    restart: always
    ports:
      - "8080:8080"

MongoDb database :

version: "3.9"
services:
  mongodb_container:
    image: mongo:latest
    ports:
      - 27017:27017
    volumes:
      - mongo_volume:/data/db

volumes:
  mongo_volume: