docker搭建gitlab
一、系统基础配置
1、主机硬件配置
系统版本 | 系统配置 | IP |
---|---|---|
CentOS7.9.2009 | 2vCPU8G | 192.168.100.200 |
2、系统基础配置
配置软件源
mv /etc/yum.repos.d/* /tmp/ #备份系统软件园
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo #配置阿里云软件源
yum clean all #清除环境
yum repolist #刷新软件源
关闭seLinux
sed -i "s/=enforcing/=disabled/g" /etc/selinux/config #修改selinx配置
关闭防火墙
systemctl stop firewalld #关闭防火墙
systemctl disable firewalld #开机关闭,防火墙不自启
清除环境
reboot #关键重新启动
二、搭建教程
1、安装docker环境
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2 #安装依赖
yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo #添加镜像源
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin #安装软件
# 更换阿里云镜像仓库
mkdir /etc/docker/
vim /etc/docker/daemon.json
{"registry-mirrors":["https://reg-mirror.qiniu.com/"]}
#重新启动docker服务
systemctl daemon-reload
systemctl restart docker
systemctl enable docker
2、安装gitlab-ce
2.1 容器启动命令
docker run -itd \
--hostname 192.168.100.200 \
--publish 8380:8380 --publish 8322:8322 \
-v /etc/localtime:/etc/localtime \
--name gitlab-ce \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
docker logs -f gitlab-ce #查看服务日志
2.2 修改配置文件
docker exec -it gitlab-ce /bin/bash
vi /etc/gitlab/gitlab.rb
gitlab_rails['gitlab_shell_ssh_port'] = 8322
external_url 'http://192.168.100.200:8380'
vi /assets/sshd_config
Port 8322
2.3 重新启动Gitlab服务
docker restart gitlab-ce #重新启动容器
docker logs -f gitlab-ce #查看服务日志
2.4 登录gitlab服务
http://192.168.100.200:8380 #浏览器访问地址
# gitlab默认账号是root密码在cat /srv/gitlab/config/initial_root_password
2.5 常见问题,账号认证问题
可以参考gitlab重置密码教学:https://www.skillixx.com/c2cd45c8.html 解决问题
赏
支付宝打赏
微信打赏


赞赏是不耍流氓的鼓励
评论系统未开启,无法评论!