工具&利器技术&日志

docker-gitlab方式部署

env

  • mac 10.13.1
  • docker 18.06.0-ce build 0ffa825
  • docker-compose version 1.22.0, build f46880f

部署过程记录-log

开始部署

sudo docker run --detach \
    --hostname gitlab.example.com \
    --publish 44301:443 --publish 8001:80 --publish 2201:22 \
    --name gitlab \
    --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

error01-执行后报错误

docker: Error response from daemon: Mounts denied:
The paths /srv/gitlab/data and /srv/gitlab/logs and /srv/gitlab/config
are not shared from OS X and are not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.

处理将命令改成下面(因为/srv/gitlab 不在docker中的共享目录中, 查看和配置 Docker -> Preferences… -> File Sharing)

sudo docker run --detach \
    --hostname gitlab.example.com \
    --publish 44301:443 --publish 8001:80 --publish 2201:22 \
    --name gitlab \
    --restart always \
    --volume ~/gitlab/config:/etc/gitlab \
    --volume ~/gitlab/logs:/var/log/gitlab \
    --volume ~/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

error02-出现错误

docker: Error response from daemon: Conflict. The container name "/gitlab" is already in use by container "aeddc3ded0840b39404b8117d0d95f9c7cff7533cd9f3f582e7415e6991f3ffc". You have to remove (or rename) that container to be able to reuse that name.

因为容器在运行中 name名字不能有重复的, docker stop gitlab && docker rm gitlab 就OK了.

error01的错误修改好后, docker 就可以运行了, 马上访问下http://127.0.0.1:8001 无法打开???

这个时候容器还在启动中docker ps查下状态Up 48 seconds (health: starting), 直到状态变成Up 5 minutes (healthy), 这时再次访问, 就打开了界面. 第一次访问需要设置root密码.

相关资料

gitlab-self

官方文档-GitLab Docker images
在Mac OS X中用Docker部署GitLab

待处理及待测试资料

关于gitlab汉化问题

GitLab快速搭建及中文汉化
快速安装 GitLab 并汉化

docker-gitlab 汉化版-未测试: https://github.com/beginor/docker-gitlab-ce

发表评论