docker-compose 快速部署 gitlab 社区版

编辑于 2025-07-06 23:05:57 阅读 2010

======================= 2025.7.6 更新 start ============

介绍

GitLab 2019年发布的 12.1 终止对 MySQL 的支持

https://about.gitlab.com/blog/removing-mysql-support/

https://about.gitlab.com/releases/2019/07/22/gitlab-12-1-released/#removal-of-mysql-client-from-omnibus

历史版本日志:

https://about.gitlab.com/releases/categories/releases/

配置文件

https://github.com/sameersbn/docker-gitlab/blob/master/docker-compose.yml

这里选择第三方修改版,redis,pgsql独立于gitlab镜像

======================= 2025.7.6 更新 end ============

直接上配置文件

docker-compose.yml

version: '3.6'
services:
  gitlab:
    image: 'gitlab/gitlab-ce:15.3.1-ce.0'
    hostname: git.cuiwei.net
    container_name: gitlab
    restart: always
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'https://git.cuiwei.net'
    ports:
      - '80:80'
      - '443:443'
      - '22:22'
    volumes:
      - './config:/etc/gitlab'
      - './logs:/var/log/gitlab'
      - './data:/var/opt/gitlab'
    shm_size: '256m'

域名 git.cuiwei.net,需要配置正确的解析和ssl证书;如果是本地测试,直接修改hosts也行

启动服务

docker-compose up -d

稍等几分钟,服务起来之后,访问https://git.cuiwei.net即可看到

WX202208242055222x.jpg

root是默认的用户,密码在./config/initial_root_password

最后吐槽一下这个镜像文件gitlab/gitlab-ce:15.3.1-ce.0,这是一个All-In-One的东西,包含nginx,redis,postgresql等。镜像压缩大小为1.09 GB,展开后2.64 GB,太大了

参考

https://docs.gitlab.com/ee/install/docker.html#install-gitlab-using-docker-compose

广而告之,我的新作品《语音助手》上架Google Play了,欢迎下载体验