This is the 17th day of my participation in the Gwen Challenge in November. Check out the details: The last Gwen Challenge in 2021″

❤️ About the author: Hello everyone, I am Xiao Xu Zhu. Java field quality creator 🏆, CSDN blog expert certification 🏆, Huawei Cloud enjoy expert certification 🏆

❤️ technology live, the appreciation

❤️ like 👍 collect ⭐ look again, form a habit

Docker basis

To master the common docker skills first, if not, please familiarize yourself with these articles

Docker commands are used to manipulate containers

Docker common operation image command

Docker mounts data from host to container (part 1)

Docker mounts data from host to container (part 2)

The hardware configuration

The official minimum recommended is 8GB with 4 cores

If the configuration is insufficient, error 502 will appear.

Image download

docker search gitlab
Copy the code

How do I query the version of an image provided by a third party?

Hub.docker.com/search?q=ng…

Find the latest version you want and copy the docker command (latest version is not recommended, it is the latest version, operation command and configuration may change).

Docker pull gitlab/gitlab - ce: 13.5.1 - ce. 0Copy the code

Download successful

Start the 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.0Copy the code

Visit address:

http://192.168.88.131:9980/

Sometimes the startup is slow, and when you access it, 502 will appear, so just wait a little while

You can also use log to track startup status

docker logs -f --tail 100 gitlab-test
Copy the code

Start-up success

As shown in the figure below, this will start successfully.

To change the password, the default account is root

After the password is set, a message is displayed.

Gitlab page localization Settings

After login, follow the steps below to set 1:

As shown in Figure 2:

Then refresh the page.

Create your first project

Step 1:

Action 2:

As shown in the figure, the project is successfully created

The clone link failed

But finding links to clone is problematic

Solution:

Into the container

docker exec -it gitlab-test /bin/bash
Copy the code

Modify gitlab. Rb

vi /etc/gitlab/gitlab.rb
Copy the code

# This file is completely commented out, so add the following configuration directly to 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
Copy the code

Save and exit

:wq
Copy the code

Out of the container

exit
Copy the code

Restart the container

docker restart gitlab-test
Copy the code

Viewing startup Logs

docker logs -f --tail 100 gitlab-test
Copy the code

Then access the address and discover that it is inaccessible

This is why, the net searched for a long time, many are copy and paste, the back in a blogger that found the answer.

There are side effects when you change the external_URL parameter in gitlab.rb (the official documentation is not very clear!). Let’s review the adjustments we 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
Copy the code

At this time, ports 80 and 22 corresponding to gitLab services have silently changed into ports 9980 and 9922.

Therefore, the corresponding Docker mapping should also be adjusted.

I’m going to delete the container.

docker stop gitlab-test
docker rm gitlab-test
Copy the code

Restart the container

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
Copy the code

The boot is fine, and the clone link is fine.

reference

Hardware configuration data: docs.gitlab.com/ee/install/…

Docker deployment gitlab:www.cnblogs.com/diaomina/p/…

Remember gitlab external_url on pit: blog.csdn.net/hrbbeeant/a…