@TOC


Recommend personal Docker articles, very detailed

【 Docker container 1】Dockerd details and installation



Build Jdk, Mysql, Nginx, Redis, Tomcat environment based on Docker in one minute



Deploy the SpringBoot project based on Docker



【 Docker container 4】 Build Docker private server based on Docker, and how to use Docker private server details



How to build Maven private server based on Docker, and how to use Maven private server



Build GitLab management code based on Docker



Automatic construction, deployment, testing and monitoring of projects based on Docker installation Jenkins



1. What is GitLab

GitLab is an open source project for warehouse management system. It is an online code management warehouse software based on Git implementation (generally private, used to build Git private server in enterprises, schools and other internal networks).

Git GitHub GitLib GitLab

GitHub is an online code repository based on Git implementation, open to the entire Internet. GitLab is an online code repository software based on Git implementation. You can use GitLab to build your own Git server similar to GitHub.

3. Build GitLab environment based on Docker deployment

1. Download the GitLab image

Note: I have built the Docker Linux system here, if not, you can see my previous article

Docker pull Beginor/gitlab-CE: 11.0.1-CE.0 docker pull beginor/ gitlab-CE: 11.0.1-CECopy the code

2. Create the GitLab configuration

Put GitLab configuration (etc), log, data (data) outside the container for future upgrade, so please prepare these three directories first. When the container is updated or uninstalled later, the important files of GitLab will still exist

mkdir -p /mnt/gitlab/etc
mkdir -p /mnt/gitlab/log
mkdir -p /mnt/gitlab/data
Copy the code

3. Run the GitLab container

docker run \ --detach \ --publish 8443:443 \ --publish 8877:80 \ --name gitlab \ --restart unless-stopped \ -v /mnt/gitlab/etc:/etc/gitlab \ -v /mnt/gitlab/log:/var/log/gitlab \ -v /mnt/gitlab/data:/var/opt/gitlab \ Beginor/gitlab - ce: 11.0.1 - ce. 0Copy the code

4. Set Http access to GitLab

Modify/MNT/gitlab/etc/gitlab rb

Edit the file: vi/MNT/gitlab/etc/gitlab rbCopy the code

Find GitLab URLThere may be no comment: note that this is added without a comment Uncomment the last line and change it to:http://IP address, write your OWN IP address hereAdd this without a comment

External_url 'http://120.77.0.58'Copy the code

Enter Esc to exit the editing mode, and then :wq to save the configuration and exit

5. Change the value of host to the IP address and port of the mapped external host

Modify/MNT/gitlab/data/gitlab – rails/etc/gitlab yml

Edit the file: vi/MNT /gitlab/data/gitlab-rails/etc/gitlab.ymlCopy the code

Find the keyword * ## Web Server Settings * and change the value of host to the mapped external host IP address and port, which will show the gitlab clone address Change: own IP address port number, must turn off port number firewall yo, otherwise cannot access, the default port number is 80 can also, this does not matter Enter Esc to exit the editing mode, and then :wq to save the configuration and exit

6. Restart the GitLab container

Git container id: docker ps stop container ID: docker stop container id delete container: docker rm container ID start gitLab image:  docker run \ --detach \ --publish 8443:443 \ --publish 8877:80 \ --name gitlab \ --restart unless-stopped \ -v /mnt/gitlab/etc:/etc/gitlab \ -v /mnt/gitlab/log:/var/log/gitlab \ -v /mnt/gitlab/data:/var/opt/gitlab \ Beginor/gitlab - ce: 11.0.1 - ce. 0Copy the code

Wait about 30 seconds after startup, access before 30 seconds can hold error 502, wait for a while

accesshttp://120.77.0.58:8877/Success!

4. How to use GitLab to achieve project management

1. Log in

Enter for the first time to set the password, set yourself on the lineAfter setting up login, user name is root, password is you just set, maybe set up the password will be wrong, but still usable, login

2. Create projects

Enter a name here, make it visible hit Private, create

3. Create other users and grant permissions to them

1. Log out

2. Register a new user

3. Do not log in after the registration is complete. In this case, grant permission to the user root as the original login user

This is the interface of the root user

1. Go to Settings > Members2. Select members, select permissions (select Developers), and click Add

See below, it has been added successfully

3. Switch the user login and find that a project already exists

3. Use Git to upload and download projects

I am configuring a newly added user, not the root user. In fact, the operation is the same. The first upload of a new user requires configuration

1. Upload and log in for the first time

Install the Git tool on the local PC, and configure a global user name and email address.

To open git bash, type the following command: Git config --global user.email "[email protected]" git config --global user.email "[email protected]"Copy the code

2. Submit your project

In fact, I’ve already told you all of these commands, so I just need to copy and paste them, but there’s one thing that’s different, notice

Git init This is a different order, With setting the port number of git remote add origin http://120.77.0.58:8877/root/boot-tool.git git add. Git commit -m "Initial commit" git push -u origin masterCopy the code

successful

3. Download the project

1. Create a local version library (create a new folder)

2. Right-click the folder –Git bash here– and go to the control panel.

Type git init to initialize the folder and make it a Git-manageable repository git initCopy the code

3. Duplicate the project address on gitee (code Cloud),

Git clone your warehouse address, click on the enter, be careful to add port git clone http://120.77.0.58:8877/root/boot-tool.gitCopy the code

Local View successful