[GITLab] docker deployment GitLab

Table of contents

1. Installation

1. Pull the Gitlab image

2. Start the container

 Two, modify the configuration

 1. Modify gitlab.rb

2. Modify http and ssh configuration 

 3. Restart in the container

3. Access

Fourth, modify the root password

 5. Login

 6. Operation

1. gitlab create project

2. Set Chinese

3. Create a user

4. Invite members to the group


1. Installation

1. Pull the Gitlab image

docker pull gitlab/gitlab-ce:latest

2. Start the container

docker run \
 -itd  \
 -p 9980:80 \
 -p 9922:22 \
 -v /home/gitlab/etc:/etc/gitlab  \
 -v /home/gitlab/log:/var/log/gitlab \
 -v /home/gitlab/opt:/var/opt/gitlab \
 --restart always \
 --privileged=true \
 --name gitlab \
 gitlab/gitlab-ce

# 查看docker启动
docker ps

 Two, modify the configuration

Please modify the following configurations in the container, not on the files mounted to the host. Otherwise, the configuration may not be updated in the container, or cannot be updated in the container immediately, resulting in successful startup of gitlab, but inaccessible

 1. Modify gitlab.rb

#进入容器内部
docker exec -it gitlab /bin/bash
#修改gitlab.rb
vi /etc/gitlab/gitlab.rb


#gitlab访问地址,可以写域名。如果端口不写的话默认为80端口
external_url 'http://192.168.1.245' 
#ssh主机ip
gitlab_rails['gitlab_ssh_host'] = '192.168.1.XX'
#ssh连接端口
gitlab_rails['gitlab_shell_ssh_port'] = 9922

 After the modification is completed, save and exit. Since we are running in docker , the http address generated on gitlab should be http://192.168.1.XX:9980, so the following files need to be modified

2. Modify http and ssh configuration 

# 修改http和ssh配置
vi /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml


# 原来是:
gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: cb3783351496
    port: 80
    https: false
# 改成

gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: 192.168.1.XX
    port: 9980
    https: false

 3. Restart in the container

 After the modification is complete, save and exit, and restart gitlab

#重启gitlab ,在容器内
gitlab-ctl restart
#退出容器 
exit

3. Access

http://192.168.1.XX:9980/

(Wait a little longer, refresh a little more)

For the first visit, you will be asked to modify the root password.
After modification, you can log in as the root user. 

 

Fourth, modify the root password

# 进入容器内部
docker exec -it gitlab /bin/bash
 
# 进入控制台
gitlab-rails console -e production
 
# 查询id为1的用户,id为1的用户是超级管理员
user = User.where(id:1).first
# 修改密码为XX
user.password='XXXX#2013'
# 保存
user.save!
# 退出
exit


 

 5. Login

Use root plus the above password

 6. Operation

1. gitlab create project

 

 

2. Set Chinese

 Log out and log in again

3. Create a user

 

 You cannot set a password for new additions. After the addition is complete, you can set a password by editing it again.

GitLab user rights management:

GitLab users have five permissions in the group: Guest, Reporter, Developer, Master, Owner

1.Guest: Can create issues, post comments, cannot read and write version library

2. Reporter: You can clone the code, but you cannot submit it. QA and PM can grant this permission

3.Developer: Can clone code, develop, submit, push, RD can grant this permission

4.Maintainer/Master: You can create projects, add tags, protect branches, add project members, edit projects, and the person in charge of the core RD can grant this permission

5.Owner: You can set the access rights of the project-Visibility Level, delete projects, migrate projects, management group members, and development group leaders can grant this permission
 

4. Invite members to the group

Guess you like

Origin blog.csdn.net/legend818/article/details/130026949