Docker builds the company's internal private cloud platform - Gitlab

table of Contents

          Introduction

         Download and configure the Docker environment

          Pull the image and start Gitlab

          Push local code to Gitlab

          to sum up

 

Introduction

1. What is gitlab?

  • web platform [website]
  • Files stored on gitlab
  • Users can save files on gitlab
  • Users can also pull down the files on gitlab

2. The difference between gitlab and github?

  •  github and gitlab are the same thing
  • Github is the role of others, is public, and needs to be connected to the Internet
  • gitlab is used inside the company

3. How to install gitlab?

  • The physical machine is installed through the rpm package
  • Start gitlab through the docker container (image name: gitlab/gitlab-ce)

Download and configure the Docker environment

1) Configure Ali's docker source

[root@hya ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

2) Install Docker

[root@hya ~]# yum -y install docker
[root@hya ~]# vim /etc/docker/daemon.json 
{"registry-mirrors": ["https://26ahzfln.mirror.aliyuncs.com"]}

3) Start Docker, close setenforce

[root@hya ~]# setenforce 0
[root@hya ~]# systemctl  start docker
[root@hya ~]# systemctl  stop firewalld   #gitlab公司局域网中可以关闭防火墙

Pull the image and start Gitlab

1) Pull the gitlab mirror

[root@hya ~]# docker image pull gitlab/gitlab-ce
Using default tag: latest
[root@hya ~]# docker image ls
REPOSITORY                   TAG                 IMAGE ID            CREATED             SIZE
docker.io/gitlab/gitlab-ce   latest              85ef0c92d667        5 days ago          1.98 GB

2) Start the container

[root@hya ~]# docker run -it -d --name gitbab -p 81:80 85ef0c92d667  #通过id启动容器
aed663b50d425501c44bd15edec7f628a0d87229d76d4a748ffea631161e0619
[root@hya ~]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                            PORTS                                 NAMES
aed663b50d42        85ef0c92d667        "/assets/wrapper"   4 seconds ago       Up 2 seconds (health: starting)   22/tcp, 443/tcp, 0.0.0.0:81->80/tcp   gitbab

3) Test

4) Set the Chinese version

Push local code to Gitlab

The steps to create a local code warehouse are here~~>  click me click me click me acridine

1) Create a project

2) Create three files and store the code warehouse

[root@hya mydate]# touch {1..3}.txt
[root@hya mydate]# echo "this is the first line" >> 1.txt
[root@hya mydate]# git add ./*
[root@hya mydate]# git commit -m "v1:三个新文件" 
[master(根提交) e485c97] v1:三个新文件
 3 files changed, 1 insertion(+)
 create mode 100644 1.txt
 create mode 100644 2.txt
 create mode 100644 3.txt

3) Create a new warehouse* (command)

[root@hya ~]# git clone git@aed663b50d42:root/mydate.git    #实际以自己操作为准
[root@hya ~]# cd mydate
[root@hya ~]# touch README.md
[root@hya ~]# git add README.md
[root@hya ~]# git commit -m "add README"
[root@hya ~]# git push -u origin master

4) Push existing folder* (command)

[root@hya ~]# cd existing_folder
[root@hya ~]# git init
[root@hya ~]# git remote add origin git@aed663b50d42:root/mydate.git
[root@hya ~]# git add .
[root@hya ~]# git commit -m "Initial commit"
[root@hya ~]# git push -u origin master

5) Push the existing Git repository* (command)

[root@hya ~]# cd existing_repo
[root@hya ~]# git remote rename origin old-origin
[root@hya ~]# git remote add origin git@aed663b50d42:root/mydate.git
[root@hya ~]# git push -u origin --all
[root@hya ~]# git push -u origin --tags

6) Pull the next project from gitlab# (operation)

[root@hya ~]# git clone http://192.168.253.120:81/root/mydate.git  #从gitlab上拉取这个项目
正克隆到 'mydate'...
Username for 'http://192.168.253.120:81': root
Password for 'http://[email protected]:81':     #我的gitlab密码是12345678
warning: 您似乎克隆了一个空版本库。

7) Modify this project and push the modified to gitlab # (operation)

[root@hya mydate]# touch {1..3}.txt
[root@hya mydate]# git add ./*
[root@hya mydate]# git commit -m "v1:第一版"
[master(根提交) 5a45008] v1:第一版
 3 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 1.txt
 create mode 100644 2.txt
 create mode 100644 3.txt
[root@hya mydate]# git push -u origin master
Username for 'http://192.168.253.120:81': root
Password for 'http://[email protected]:81': 
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 224 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://192.168.253.120:81/root/mydate.git
 * [new branch]      master -> master
分支 master 设置为跟踪来自 origin 的远程分支 master。

to sum up

           This is part of the simulation architecture in the process of studying this automated online system, and the private cloud part ends here. It is not easy to create, and your "one key and three links" is my biggest motivation.

Guess you like

Origin blog.csdn.net/yeyslspi59/article/details/108885009