docker搭建gitlab

一:安装docker 

具体安装过程可参考docker安装

二:创建docker-compose.yml文件,复制以下内容到文件中。

version: "3"

services:
gitlab:
restart: always
image: gitlab/gitlab-ce:14.0.2-ce.0
container_name: gitlab
hostname: gitlab.soulteary.com
ports:
- "80:80"
- "443:443"
- "2222:22"
volumes:
- ./config:/etc/gitlab
- ./data:/var/opt/gitlab
environment:
TZ: Asia/Shanghai
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab.soulteary.com'
gitlab_rails['lfs_enabled'] = true
gitlab_rails['time_zone'] = 'Asia/Shanghai'

三:运行docker-compose文件 命令 docker-compose up。(可以添加 -d 参数后台运行)通过80端口在浏览器中打开

四:修改gitlab登录密码,使用管理员权限运行以下命令,根据提示设置登录密码。

docker exec -it gitlab gitlab-rake "gitlab:password:reset[root]"

五:通过登录密码登录gitlab,现在可以愉快的玩耍了。

原文地址:https://www.cnblogs.com/blogphp/p/docker_gitlab.html