1, Environment
linux: centos7 docker:18.06.3-ce gitlab: twang2218/gitlab-ce-zh(Sinicized GitLab Community Edition)
2, Installation procedure
-
To configure the image accelerator (skip this step if you have already configured it), open the / etc/docker/daemon.json file:
[root@localhost docker]# vi /etc/docker/daemon.json
The configuration is as follows. Here is the docker image warehouse of Netease, which can be used for other purposes.
{"registry-mirrors": ["http://hub-mirror.c.163.com"]}
After configuration: wq saves the configuration and restarts docker
[root@localhost docker]# service docker restart
-
Find image and pull image
[root@localhost docker]# docker search gitlab [root@localhost docker]# docker pull twang2218/gitlab-ce-zh [root@localhost docker]# docker images
After the pull is successful, you can use docker images to see the image just pulled
-
Create the mounted directory, and mount the log files, data files and configuration files of the gitlab container to the outside
[root@localhost docker]# mkdir -p /docker/gitlab/config [root@localhost docker]# mkdir -p /docker/gitlab/logs [root@localhost docker]# mkdir -p /docker/gitlab/data
-
Create container
docker run --detach --hostname 192.168.200.128 --publish 8443:443 --publish 8080:80 --publish 2222:22 --name gitlab --restart always --volume /docker/gitlab/config:/etc/gitlab --volume /docker/gitlab/logs:/var/log/gitlab --volume /docker/gitlab/data:/var/opt/gitlab twang2218/gitlab-ce-zh
--hostname 192.168.200.128: Specifies the ip or domain name of the host
--publish 8443:443: port 8443 of the host and port 443 of the gitlab container are insidious
--publish 8080:80: Port 8080 of the host and port 80 of the gitlab container are insidious
--publish 2222:22: Port 2222 of the host and port 22 of the gitlab container are insidious
-
Configure ssh connection
The default port for ssh connection is port 22, so you need to change the configuration
Modify the file gitlab.rb under / docker/gitlab/config/gitlab.rb
[root@localhost docker]# vi /docker/gitlab/config/gitlab.rb
Set 22 of the gitlab_rails['gitlab_shell_ssh_port '] variable to 2222
# gitlab_rails['gitlab_shell_ssh_port'] = 2222
3, Use
- Visit gitlab: Enter http://192.168.200.128:8080/ You can access the login interface of gitlab
-
Change the root password (the first login needs to be modified)
-
Just log in
-
The url of the ssh connection and the http connection needs to be changed, or they can't be connected (important). The link copied from the figure below has less port number.
ssh:
ssh://git@192.168.200.128:2222/heliufang/test.git git@192.168.200.128:heliufang/test.git
http:
http://192.168.200.128:8080/heliufang/test.git
4, 500 problem solving
1. Wait a little longer and visit again
2. Increase memory, more than 4g memory, generally no strange problems
3. It's not enough to install the substitute gitblit. This can be deployed with war package. It's easier to install than gitlab and has strong compatibility (it can be deployed on linux and windows)
Installation reference of gitblit: https://www.cnblogs.com/helf/p/12894180.html