Docker部署gitlab
2019-06-26 本文已影响0人
糊涂蟲
一、确保已安装Docker并已启动
# 安装docker
yum install docker
# 启动docker
systemctl start docker
二、搜索并拉取镜像
# 搜索gitlab镜像
[root@doc ~]# docker search gitlab
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
gitlab/gitlab-ce GitLab Community Edition docker image based … 2550 [OK]
sameersbn/gitlab Dockerized gitlab web server 1113 [OK]
gitlab/gitlab-runner GitLab CI Multi Runner used to fetch and run… 519 [OK]
twang2218/gitlab-ce-zh 汉化的 GitLab 社区版 Docker Image 183 [OK]
gitlab/gitlab-ee GitLab Enterprise Edition docker image based… 148
# 一般我们拉取官方镜像,本次拉取汉化版本的镜像
[root@doc ~]# docker pull twang2218/gitlab-ce-zh
Using default tag: latest
8ee29e426c26: Pull complete
6e83b260b73b: Pull complete
e26b65fd1143: Pull complete
40dca07f8222: Pull complete
b420ae9e10b3: Pull complete
a218309dd589: Pull complete
5c60fd7ba0ce: Pull complete
659c2144b5a3: Pull complete
8289bbac0d0e: Pull complete
31bbd150e8a7: Pull complete
9114e78243fa: Pull complete
e242e5cd1314: Pull complete
0a079dc3f92c: Pull complete
f0e195b09fd2: Pull complete
6e23346e2f58: Pull complete
91f00659be69: Pull complete
a1031bcc5b2c: Pull complete
e3074327c7b1: Pull complete
a917618dbe42: Pull complete
Digest: sha256:62686b74c6fca5ece8ed582d03a126c5988423dd8a19ce70e9a22357ffcaf1c8
Status: Downloaded newer image for twang2218/gitlab-ce-zh:latest
# 查看镜像是否已成功拉取
[root@doc ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
dockertest_web latest d61d5441217c 2 hours ago 90.3MB
redis alpine 4f188304d84f 11 hours ago 51.1MB
ubuntu 16.04 13c9f1285025 7 days ago 119MB
mysql 5.7 a1aa4f76fab9 2 weeks ago 373MB
python 3.6-alpine 35bb01a3d284 6 weeks ago 79.1MB
twang2218/gitlab-ce-zh latest 18da462b5ff5 10 months ago 1.61GB
三、启动容器
[root@doc ~]# docker run -d --name gitlab01 -p 8080:80 -p 1443:443 -p 122:22 -v /root/conf/gitlab:/etc/gitlab -v /root/data/gitlab:/var/opt/gitlab -v /root/logs/gitlab:/var/log/gitlab twang2218/gitlab-ce-zh:latest
d726472c11aa3d192f178722873f6345ed5cb5772b48c9c229b67f8a780ea090
[root@doc ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d726472c11aa twang2218/gitlab-ce-zh:latest "/assets/wrapper" 9 seconds ago Up 9 seconds (health: starting) 0.0.0.0:122->22/tcp, 0.0.0.0:8080->80/tcp, 0.0.0.0:1443->443/tcp gitlab01
四、登录8080端口
image.png五、修改配置
[root@doc gitlab]# cd ~/conf/gitlab/
[root@doc gitlab]# vi gitlab.rb
#修改外部地址
external_url 'https://gitlab.yinnote.com'
#然后重启docker生效
[root@doc gitlab]# docker restart gitlab01
gitlab01
#登陆容器, 重启配置
[root@doc gitlab]#docker exec -it docker01 bash
root@d726472c11aa:/#gitlab-ctl reconfigure