Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Pitfalls encountered in docker deployment of gitlab

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Installation and deployment

Install docker first

Yum-y install docker

Systemctl enable docker

Systemctl start docker

Find gitlab version

Docker search gitlab

Just select the official image.

Download the image

Docker pull gitlab/gitlab-ce

Start the service

Docker run-itd-v / root:/etc/gitlab-p 80:80-p 22:22-name gitlab gitlab/gitlab-ce

The following figure shows that local port 22 has been occupied and the container cannot be started.

Try not to map port 22.

Docker run-itd-v / root:/etc/gitlab-p 80:80-name gitlab gitlab/gitlab-ce

Check the startup log. The startup process will take some time.

Docker logs-f gitlab

Log in to gitlab

Http://192.168.60.133/

You need to change your password to log in for the first time

Create a project test

Create a test file

Add a public key

Check the download address and you can see that there is no IP. The address is actually the ID of the container.

We need to change the address to our IP address so that it can be downloaded

When I started the container earlier, I already mapped the directory in the container to the local directory through-v / root:/etc/gitlab.

Edit configuration file, modify configuration

Vim / root/gitlab.rb

Then restart the container

Docker restart gitlab

After logging in to gitlab to check the project download address, it has been changed.

Download it and try

Git clone git@192.168.60.133:root/test.git

Git clone ssh://git@192.168.60.133:root/test.git

Git clone http://192.168.60.133/root/test.git

You can see that http can be downloaded. This is why, because http is downloaded through port 80, ssh is downloaded through port 22, but port 22 is not mapped, even if it is mapped, it is occupied by host port 22.

So let's try it again, modify the gitlab configuration and open the SSH service and port.

Then restart the gitlab container

Docker restart gitlab

After logging in to gitlab to check the download address, you can see that the address has been changed and ssh:// and port 222have been automatically added.

Try downloading

Still no, why?

Because there is no ssh port mapping when starting the container before, map port 222to port 22 in the container, try again!

Delete first

Docker stop gitlab

Docker rm gitlab

Try it one last time.

Docker run-itd-v / root:/etc/gitlab-p 80:80-p 222pur22-- name gitlab gitlab/gitlab-ce

Log in to the gitlab address, reset the account password, then add a project and create a file, and don't forget to add the client's public key.

Download the test for the last time, do what you should do if you don't succeed!

Oh, my God, it's okay!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report