Verisoft Wiki

We will always want to use docker compose when we running services.

There is many reasons why, but on this page we focusing on the principles of good docker compose file with the company’s specific conventions.


Let's look on an example of docker compose file of jenkins:

version: '3.8'
services:
  jenkins:
    image: jenkins/jenkins:latest-jdk21
    container_name: jenkins
    restart: always
    privileged: true
    user: root
    ports:
      - 9080:8080
      - 50000:50000
    volumes:
      - /srv/jenkins/jenkins_home:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.jenkins.rule=Host(`jenkins.verisoft.io`)"
      - "traefik.http.routers.jenkins.entrypoints=websecure"
      - "traefik.http.routers.jenkins.tls.certresolver=myresolver"
      - "traefik.http.services.jenkins.loadbalancer.server.port=8080"
    networks:
      - generalWeb
networks:
  generalWeb:
    external: true

Key Points

ℹ️ Info: Replace all {service-name} and {service-port} with the actual service name and port

ℹ️ Info: -d or --detach - Detached mode: Run containers in the background