常用 docker-compose 集合

142 阅读1分钟

gitlab

原文 注意一定要指定版本,不要使用latest

这里限制了日志文件大小为20M, 数据文件存储到docker-compose.yml 文件所在目录

version: '3.6'
services:
  gitlab:
    image: gitlab/gitlab-ce:16.10.6-ce.0
    container_name: gitlab-ce
    restart: always
    hostname: '10.79.20.220'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://10.79.20.220:9000'
    ports:
      - '9000:9000'
    volumes:
      - './db/config:/etc/gitlab'
      - './db/data:/var/opt/gitlab'
    shm_size: '256m'
    logging:
      driver: "json-file"
      options:
        max-size: "20m"
        max-file: "10"

mysql 5.7

version: "3"
services:
  db:
    image: mysql:5.7.42
    privileged: true
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: 1314520
      TZ: Asia/Shanghai
    command:
      --lower_case_table_names=1
      --max_connections=1000
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_general_ci
      --wait_timeout=31536000
      --interactive_timeout=31536000
      --default-authentication-plugin=mysql_native_password
      --max_allowed_packet=100M
      --transaction-isolation=READ-COMMITTED
      --sql_mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
    ports:
      - 3306:3306
    volumes:
      - ./db:/var/lib/mysql