注:在本文章所有的ip 地址均为本地虚拟机IP,需修改为自己的服务器IP。密码默认是12345678
1.下载镜像
docker pull twang2218/gitlab-ce-zh
2.在根目录下创建文件夹gitlab,并进入到gitlab文件夹下
创建docker-compose.xml
[root@localhost /]# mkdir gitlab
[root@localhost /]# cd gitlab/
[root@localhost gitlab]# vi docker-compose.yml
version: '3'
services:
gitlab:
image: 'twang2218/gitlab-ce-zh'
restart: always
hostname: '192.168.0.201'
environment:
TZ: 'Asia/Shanghai'
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://192.168.0.201:9001'
gitlab_rails['gitlab_shell_ssh_port'] = 2222
unicorn['port'] = 8888
nginx['listen_port'] = 9001
ports:
- '9001:9001'
- '8443:443'
- '2222:22'
volumes:
- /gitlab/config:/etc/gitlab
- /gitlab/data:/var/opt/gitlab
- /gitlab/logs:/var/log/gitlab
- 启动
docker-compose up
gitlab启动需要一定的时间。
启动成功后访问地址:http://192.168.0.201:9001/
首次访问需修改root密码
登录