1、 mkdir -p /docker/gitlab/{logs,config,data}
2、
cat > /docker/gitlab/docker-compose.yml <<EOF
version: "3"
services:
gitlab:
image: gitlab/gitlab-ce
container_name: gitlab
restart: always
hostname: 'localhost'
environment:
TZ: 'Asia/Shanghai'
GITLAB_OMNIBUS_CONFIG: |
external_url "http://localhost:9090"
gitlab_rails['gitlab_shell_ssh_port'] = 2222
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'xxx@xxxxx.com'
gitlab_rails['gitlab_email_display_name'] = 'xxx'
gitlab_rails['gitlab_email_reply_to'] = 'xxxx@xxxxx.com'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.mxhichina.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "xxx@xxxx.com"
gitlab_rails['smtp_password'] = "xxxxx"
gitlab_rails['smtp_domain'] = "smtp.mxhichina.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
gitlab_rails['smtp_tls'] = true
ports:
- '9090:9090'
- '2222:22'
networks:
- cidi
volumes:
- '/docker/gitlab/config:/etc/gitlab'
- '/docker/gitlab/logs:/var/log/gitlab'
- '/docker/gitlab/data:/var/opt/gitlab'
logging:
driver: "json-file"
options:
max-size: "20m"
max-file: "10"
networks:
cidi:
external: true
EOF
3、docker-compose up -d