centos7先更新containerd
sudo yum install containerd
docker pull gitlab/gitlab-ce:16.3.4-ce.0
docker-compose.yml
bash
version: '3.6'
services:
web:
image: 'gitlab/gitlab-ce:16.3.4-ce.0'
restart: always
hostname: 'node2'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://192.168.227.128'
# Add any other gitlab.rb configuration here, each on its own line
ports:
- '80:80'
- '443:443'
- '2222:22'
volumes:
- '/usr/share/local/gitlab/config:/etc/gitlab'
- '/usr/share/local/gitlab/logs:/var/log/gitlab'
- '/usr/share/local/gitlab/data:/var/opt/gitlab'
shm_size: '256m'
c
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.227.128 netmask 255.255.255.0 broadcast 192.168.227.255
inet6 fe80::20c:29ff:fedf:8b prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:df:00:8b txqueuelen 1000 (Ethernet)
RX packets 48559 bytes 63651085 (60.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 25226 bytes 2113318 (2.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
c
在浏览器中输
入以下地址来访问GitLab界面:
http://192.168.227.128:80 或者 http://localhost:80
https://192.168.227.128:443 或者 https://localhost:443
ssh://192.168.227.128:2222 或者 ssh://localhost:2222
重置root密码:
1.进入容器:
docker exec -it <容器名称或ID> /bin/bash
2.进入GitLab Rails控制台:
gitlab-rails console
3.重置root用户的密码:
bash
user = User.where(id: 1).first
user.password = '新密码'
user.password_confirmation = '新密码'
user.save
这个时候密码可能设置错误,因为gitlab的密码策略非常严格,包括至少一个小写字母、一个大写字母、一个数字和一个特殊字符,而且,密码包含常见的单词和字母组合也不行,而且,密码里面最好不要有!符号,可以用@代替
如果上面的步骤失败了,可以尝试这个步骤:
bash
gitlab-rake "gitlab:password:reset[root, 'R0@tR00tP@ssw0rd']"
gitlab-ctl restart
4.退出GitLab Rails控制台:
exit
5.退出容器终端:
exit
装好之后长这样: