1:拉取镜像
docker pull gitlab/gitlab-ce
2:docker-compose.yml
version: '2'
services:
gitlab:
image: gitlab/gitlab-ce
container_name: 'gitlab'
restart: always
privileged: true
hostname: 'gitlab'
ports:
- "8000:80"
- "443:443"
- "222:22"
volumes:
- /home/gitlab/config:/etc/gitlab
- /home/gitlab/logs:/var/log/gitlab
- /home/gitlab/data:/var/opt/gitlab
2:运行并测试
[root@localhost gitlab]# docker-compose up -d
Creating network "gitlab_default" with the default driver
Creating gitlab ... done

3:注意事项:
不能运行-开启防火墙:systemctl start firewalld
运行之后不能访问页面-关闭防火墙:systemctl stop firewalld