MongoDB and PostgreSQL in portainer stack

Running databases as a Portainer stack.

YAML
version: "2"
services:
  mongodb:
    image: mongo:4.4.19-focal
    environment:
     PUID: 1000
     PGID: 1000
     MONGO_DATA_DIR: /data/db
    volumes:
      - mongodb_data:/data/db
    ports:
      - 27017:27017
    restart: unless-stopped
    network_mode: host

  postgres:
    image: postgres
    environment:
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: secret
    ports:
      - 5432:5432
    volumes:
      - postgres_data:/var/lib/postgresql
    restart: unless-stopped
    network_mode: host

volumes:
  mongodb_data:
  postgres_data:

Last update: September 18, 2024
Created: September 18, 2024