❤️ About the author: a high-quality creator in the Java field 🏆, CSDN blog expert certification 🏆
❤️ Technical work should be rewarded
❤️ give the thumbs-up 👍 Collection ⭐ Look again and form a habit
docker Foundation
You should first master the common skills of docker. If you are not familiar with it, please be familiar with these articles
docker common operation container commands
docker common operation image commands
How docker mounts data from the host to the container (1)
How docker mounts data from the host to the container (2)
hardware configuration
The minimum configuration officially recommended is 4-core 8G
If the configuration is insufficient, an error message 502 will appear.
Image download
docker search gitlab
How to query the version of an image provided by a third party:
https://hub.docker.com/search?q=nginx&type=image
Find the specified version you want and copy the docker command (it is not recommended to directly use the latest version. This is to obtain the latest version. The operation command and configuration may change)
docker pull gitlab/gitlab-ce:13.5.1-ce.0
Download succeeded
Start container
docker run \ -itd \ -p 9980:80 \ -p 9922:22 \ -v /usr/local/gitlab-test/etc:/etc/gitlab \ -v /usr/local/gitlab-test/log:/var/log/gitlab \ -v /usr/local/gitlab-test/opt:/var/opt/gitlab \ --restart always \ --privileged=true \ --name gitlab-test \ gitlab/gitlab-ce:13.5.1-ce.0
Access address:
http://192.168.88.131:9980/
Sometimes the startup is slow, and 502 will appear when accessing. Just wait a little longer
You can also follow up the startup through the log
docker logs -f --tail 100 gitlab-test
Start successful
As shown in the figure below, the startup is successful.
To change the password, the default account is root
After setting the password, you will be prompted.
Gitlab page Sinicization settings
After logging in, set one as follows:
As shown in Figure 2:
Then refresh the page.
Create first project
As shown in step 1:
Operation 2:
As shown in the figure, the project is created successfully
There is a problem with the clone link
However, there is a problem finding the link to be cloned
Solution:
Enter the container
docker exec -it gitlab-test /bin/bash
Modify gitlab.rb
vi /etc/gitlab/gitlab.rb
#This file is completely commented out, so add the following configuration directly on the first line
external_url 'http://192.168.88.131:9980' gitlab_rails['gitlab_ssh_host'] = '192.168.88.131' gitlab_rails['gitlab_shell_ssh_port'] = 9922
Save and exit
:wq
Exit container
exit
Restart container
docker restart gitlab-test
View startup log
docker logs -f --tail 100 gitlab-test
Then access the address and you will find that you can't access it
Why? I searched online for a long time. Many of them were copied and pasted. Later, I found the answer from a blogger.
When changing external in gitlab.rb_ URL parameters will have side effects (not clearly stated in the official documents!). Let's review the adjustments we have made
external_url 'http://192.168.88.131:9980' gitlab_rails['gitlab_ssh_host'] = '192.168.88.131' gitlab_rails['gitlab_shell_ssh_port'] = 9922
At this time, port 80 and port 22 corresponding to gitlab's service have silently changed to port 9980 and port 9922.
Therefore, the corresponding docker mapping needs to be adjusted.
Delete the previous container first.
docker stop gitlab-test docker rm gitlab-test
Restart the container again
docker run \ -itd \ -p 9980:9980 \ -p 9922:9922 \ -v /usr/local/gitlab-test/etc:/etc/gitlab \ -v /usr/local/gitlab-test/log:/var/log/gitlab \ -v /usr/local/gitlab-test/opt:/var/opt/gitlab \ --restart always \ --privileged=true \ --name gitlab-test \ gitlab/gitlab-ce:13.5.1-ce.0
The startup is normal, and the clone link is normal.
reference resources
Hardware configuration data: https://docs.gitlab.com/ee/install/requirements.html#hardware-requirements
docker deployment gitlab:https://www.cnblogs.com/diaomina/p/12830449.html
gitlab external_ Step on the pit: https://blog.csdn.net/hrbbeeant/article/details/104380009
Today is the 15th / 100th day of continuous writing.
You can pay attention to me, praise me, comment on me and collect me.