docker compose 搭建 gitlab

1.在安装有docker的机器上:
pip install docker-compose
2.将一下内容保存在一个yml文件

version: '2'
services:
  gitlab:
    image: 'twang2218/gitlab-ce-zh:latest'
    container_name: "gitlab"
    restart: unless-stopped
    privileged: true
    hostname: 'gitlab'
    environment:
     TZ: 'Asia/Shanghai'
     GITLAB_OMNIBUS_CONFIG: |
       external_url 'http://gitlab.aa.com'
       gitlab_rails['time_zone'] = 'Asia/Shanghai'
       gitlab_rails['smtp_enable'] = true
       gitlab_rails['smtp_address'] = "smtp.163.com"
       gitlab_rails['smtp_port'] = 465
       gitlab_rails['smtp_user_name'] = "[email protected]"
       gitlab_rails['smtp_password'] = "授权码"
       gitlab_rails['smtp_domain'] = "163.com"
       gitlab_rails['smtp_authentication'] = "login"
       gitlab_rails['smtp_enable_starttls_auto'] = true
       gitlab_rails['smtp_tls'] = true
       gitlab_rails['gitlab_email_from'] = '[email protected]'
       gitlab_rails['gitlab_shell_ssh_port'] = 10022
    ports:
       - '18080:80'
       - '18443:443'
       - '10022:22'
    volumes:
       - /opt/gitlab/config:/etc/gitlab
       - /opt/gitlab/data:/var/opt/gitlab
       - /opt/gitlab/logs:/var/log/gitlab

3.文件里对应挂载的目录和映射的端口 可以根据自己需求更改
4.执行docker-compose -f gitlab-compose.yml 即可。

你可能感兴趣的:(容器技术)