Docker部署Gitlab

Docker部署Gitlab

文章目录

前置环境

docker 19.03.13
es 7.2.0

部署步骤

初始化配置文件

shell 复制代码
-- 拉取镜像
docker pull beginor/gitlab-ce:10.7.5-ce.0

-- 挂载目录
mkdir -p /home/feature/docker/software/gitlab/config
mkdir -p /home/feature/docker/software/gitlab/logs
mkdir -p /home/feature/docker/software/gitlab/data

80端口部署方式(二选一)

shell 复制代码
 docker run --name=gitlab -d \
    -p 80:80 -p 443:443 -p 8922:22 \
    --restart always \
    -e TZ=Asia/Shanghai \
    -m 3072m
    -v /home/feature/docker/software/gitlab/config:/etc/gitlab \
    -v /home/feature/docker/software/gitlab/logs:/var/log/gitlab \
    -v /home/feature/docker/software/gitlab/data/:/var/opt/gitlab \
    beginor/gitlab-ce:10.7.5-ce.0

非80端口需要的部署方式(二选一)

shell 复制代码
# 先更换端口启动项目,如7001 置换为原来的80
 docker run --name=gitlab -d \
    -p 7001:7001 -p 7002:443 -p 7003:22 \
    --restart always \
    -e TZ=Asia/Shanghai \
    -m 3072m
    -v /home/feature/docker/software/gitlab/config:/etc/gitlab \
    -v /home/feature/docker/software/gitlab/logs:/var/log/gitlab \
    -v /home/feature/docker/software/gitlab/data/:/var/opt/gitlab \
    beginor/gitlab-ce:10.7.5-ce.0

xxx.xxx.xxx.xxx 为 外网访问IP

修改 gitlab.rb

vim /home/feature/docker/software/gitlab/config/gitlab.rb

shell 复制代码
# 配置http协议所使用的访问地址,不加端口号默认为80
external_url 'http://xxx.xxx.xxx.xxx:7001'
# 配置ssh协议所使用的访问地址和端口
gitlab_rails['gitlab_ssh_host'] = 'xxx.xxx.xxx.xxx'
# 此端口是run时22端口映射的99端口
gitlab_rails['gitlab_shell_ssh_port'] = 7003

修改 gitlab.yml

vim /home/feature/docker/software/gitlab/data/gitlab-rails/etc/gitlab.yml

shell 复制代码
gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: xxx.xxx.xxx.xxx 
    port: 7001
    https: false

    # Uncommment this line below if your ssh host is different from HTTP/HTTPS one
    # (you'd obviously need to replace ssh.host_example.com with your own host).
    # Otherwise, ssh host will be set to the `host:` value above
    ssh_host: xxx.xxx.xxx.xxx

刷新配置

shell 复制代码
docker exec -it gitlab gitlab-ctl restart
相关推荐
BullSmall7 小时前
Anolis OS 8.10 完整安装 Docker CE(生产可用,解决 podman 冲突)
docker·容器·podman
梦梦代码精10 小时前
开源AI应用平台BuildingAI解析:插件化架构、应用市场与热门案例
人工智能·机器学习·docker·开源
IT瑞先生13 小时前
Docker快速部署Mysql的三种方法——实操篇
mysql·adb·docker
梦远青城13 小时前
Docker 部署python的paddle进行OCR文字识别身份证
python·docker·ocr·paddle·身份证识别
CodexDave14 小时前
数据库连接池耗尽:排查顺序与三层兜底
服务器·前端·数据库·git·云原生·容器·kubernetes
糖果罐子♡14 小时前
TortoiseGit 首次上传本地工程至已初始化的GitLab仓库教程
gitlab
java_logo14 小时前
ELK Docker Compose 部署指南:轻松搭建日志检索平台
elk·elasticsearch·docker·容器·kibana·logstash·轩辕镜像
ShallWeL15 小时前
Orin 上用 Docker 跑通目标检测功能
人工智能·目标检测·docker·容器
辰同学ovo16 小时前
用“舞台换景”讲清 Docker 的 Restart 与 Recreate
运维·docker·容器
Byron Loong16 小时前
【Git】如何检查 Ubuntu 系统上 gitLab 是否开启
git·ubuntu·gitlab