Docker GitLab镜像部署

环境说明

系统环境: CentOS Linux release 7.4
     docker Version: 18.03.1-ce

运行镜像

docker run --detach \
  --hostname gitlab.example.org \
  --publish 443:443 --publish 80:80 \
  --name gitlab \
  --restart always \
  --volume /opt/gitlab:/etc/gitlab \
  --volume /opt/gitlab/logs:/var/log/gitlab \
  --volume /opt/gitlab/data:/var/opt/gitlab \
  gitlab/gitlab-ce:latest

上述命令将下载并启动 GitLab CE 容器,对外访问端口 HTTP和HTTPS。所有GitLab 数据将被存储在/opt/gitlab 这个目录下。该容器将在系统重启时自动重启。

运行GitLab CE 在一个外网IP

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

查看服务启动情况:

[root@localhost~]# docker ps
CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS                   PORTS                                                        NAMES
09c059331c01        gitlab/gitlab-ce:latest   "/assets/wrapper"   9 minutes ago       Up 9 minutes (healthy)   10.200.3.105:80->80/tcp, 22/tcp, 10.200.3.105:443->443/tcp   gitlab

查看日志:

# docker logs -f gitlab

提示: 你可以通过http://ip 或 https://ip 访问GitLab  ,当你第一次访问GitLab 时,你将被要求设置admin 密码。你设置密码后,就可以用用户名 root 和刚才设置的密码登陆了。

参考文档:https://docs.gitlab.com/omnibus/docker/README.html

     http://blog.51cto.com/13673090/2096145

猜你喜欢

转载自www.cnblogs.com/saneri/p/9122183.html