Centos7.4 uses Docker to deploy Gitlab

1. Install Docker, start, import images

yum -y install docker

systemctl restart docker

systemctl enable docker

docker load < gitlab_zh.tar

Second, modify the default port of the machine's ssh, because docker starts gitlab needs to occupy port 22

vim /etc/ssh/sshd_config

systemctl restart sshd

docker run -d -h gitlab --name gitlab -p 443: 443 -p 80:80 -p 22:22 --restart always -v / srv / gitlab / config: / etc / gitlab -v / srv / gitlab / logs: / var / log / gitlab -v / srv / gitlab / data gitlab_zh: latest
started the container successfully. Because the gitlab image is very large, it takes a long time.

Waiting. . . . . . . . .

3. By default, the machine uses port 80. Can be accessed directly, the first access will require a password

The login account is root and the password is the new password you set.

Create a group, project, user is bound to the group, submit ssh public key

I created a group named devops in the web interface, created a project named myproject in the group, and created a user named harry, whose role is the main program ape in the group. And put the remote machine's ssh public key into the settings.

Fourth, install git on the remote machine, configure git local configuration, pull the gitlab project to the local

yum -y install git

mkdir devops

cd devops/

 git init

git clone [email protected]:devops/myproject.git

cd myproject/

Create a code file, add it to the buffer area, submit the code to the local warehouse, label the code with the version, push the code to the remote warehouse, and push the label to the remote warehouse

Check gitlab, the code has been uploaded.

Update the index.html file, and then submit it again, the version is 2.0

The version is 2.0, but the tag has 2 tags.

View tags

According to the label, you can view the corresponding version of the code file.

4. For other remote hosts, if it is the first time to pull the gitlab project, you can directly git clone. Others to be updated can be directly git pull.

 

Published 73 original articles · praised 4 · 20,000+ views

Guess you like

Origin blog.csdn.net/qq_27592485/article/details/102414584