文档说明: 只是记录关键点
自建gitlab
version: "3"
services:
gitlab-ce:
image: gitlab/gitlab-ce:15.5.1-ce.0 # 指定版本比较好
# image: gitlab/gitlab-ce:latest
restart: always
hostname: gitlab
container_name: gitlab
volumes:
- ./etc:/etc/gitlab
- ./logs:/var/log/gitlab
- ./data:/var/opt/gitlab
ports:
- "80:80"
- "443:443"
- "22:22"
自建gitlab-ci
version: "3"
services:
gitlab-runner:
image: gitlab/gitlab-runner:v15.5.0
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/etc/gitlab-runner
container_name: gitlab-runner
restart: always
启动、关闭、查看日志
# 启动
docker-compose -f docker-compose.yaml up -d
# 关闭
docker-compose -f docker-compose.yaml down --remove-orphans
# 查看日志
docker-compose -f docker-compose.yaml logs -f
gitlab修改root密码
# 进入容器
docker exec -it gitlab bash
# 进入gitlab console
gitlab-rails console
user = User.find_by_username 'root'
new_password = ::User.random_password
user.password = new_password
user.password_confirmation = new_password
user.send_only_admin_changed_your_password_notification!
user.save
gitlab-ci 注册
# 进入容器
docker exec -it gitlab-runner bash
gitlab-runner register
# 后续按照提示操作即可