Skip to main content

02. Docker Compose File

Docker compose file

compose.yml
services:
  peertube:
    users: "1000:1000"
    # If you don't want to use the official image and build one from sources:
    # build:
    #   context: .
    #   dockerfile: ./support/docker/production/Dockerfile
    image: chocobozzz/peertube:production
    # Use a static IP for this container because nginx does not handle proxy host change without reload
    # This container could be restarted on crash or until the postgresql database is ready for connection
    networks:
      default:
        ipv4_address: 172.34.0.42
        ipv6_address: fdab:e4b3:21a2:ef1b::42
    env_file:
      - .env

    ports:
     - "1935:1935" # Comment if you don't want to use the live feature
     - "1001:9000" # Uncomment if you use another webserver/proxy or test PeerTube in local, otherwise not suitable for production
    volumes:
      # Remove the following line if you want to use another webserver/proxy or test PeerTube in local
      - assets:/app/client/dist
      - ./docker-volume/data:/data
      - ./docker-volume/config:/config
    depends_on:
      - postgres
      - redis
      - postfix
    restart: "always"

  postgres:
    users: "1000:1000"
    # Bumping the major version on an existing data directory requires a proper PostgreSQL upgrade
    # See https://docs.joinpeertube.org/install/docker#upgrade-postgresql-container
    image: postgres:17-alpine
    env_file:
      - .env
    volumes:
      # With PostgreSQL >= 18, witch the mount target to /var/lib/postgresql instead
      # (data dir is nested under a subfolder, for example /var/lib/postgresql/18/docker)
      # See https://hub.docker.com/_/postgres for more information
      - ./docker-volume/db:/var/lib/postgresql/data
    restart: "always"

  redis:
    users: "1000:1000"
    image: redis:8-alpine
    volumes:
      - ./docker-volume/redis:/data
    restart: "always"

  postfix:
    users: "1000:1000"
    image: mwader/postfix-relay
    env_file:
      - .env
    volumes:
      - ./docker-volume/opendkim/keys:/etc/opendkim/keys
    restart: "always"

networks:
  default:
    enable_ipv6: true
    ipam:
      driver: default
      config:
      - subnet: 172.34.0.0/16
      - subnet: fdab:e4b3:21a2:ef1b::/64

volumes:
  assets:

ย