预先准备docker 环境这里不做介绍
获取gitlib 镜像
执行 docker pullgitlab/gitlab-ce
cloud@ubuntu14044:~$ docker pull gitlab/gitlab-ce
Using default tag: latest
latest: Pulling from gitlab/gitlab-ce
6599cadaf950: Pull complete
23eda618d451: Pull complete
f0be3084efe9: Pull complete
52de432f084b: Pull complete
a3ed95caeb02: Pull complete
c7bdadca674f: Pull complete
f77fd87d9501: Pull complete
bf401969663c: Pull complete
084dc13ccc83: Pull complete
Digest: sha256:8c6ad3fdccf8e97a114af7622edbfa66b41ffe98b2abb7870fb4804192b77f14
Status: Downloaded newer image for gitlab/gitlab-ce:latest
cloud@ubuntu14044:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
gitlab/gitlab-ce latest 98dfe52bcfd2 6 days ago 1.185 GB
<none> <none> da1376434ab5 3 weeks ago 320.4 MB
<none> <none> c698fd9ffe04 3 weeks ago 120.1 MB
ubuntu latest 44776f55294a 3 weeks ago 120.1 MB
centos latest 778a53015523 6 weeks ago 196.7 MB
hello-world latest 690ed74de00f 7 months ago 960 B
cloud@ubuntu14044:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
执行 sudo docker run --detach --hostnamegitlab.example.com --publish 444:443 --publish 80:80 --publish 222:22 --namegitlab --restart always --volume /srv/gitlab/config:/etc/gitlab --volume/srv/gitlab/logs:/var/log/gitlab --volume /srv/gitlab/data:/var/opt/gitlabgitlab/gitlab-ce:latest
cloud@ubuntu14044:~$ sudo docker run --detach --hostname gitlab.example.com --publish 444:443 --publish 800:80 --publish 222: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
[sudo] password for cloud:
344d8e23d32af42ac9e5abd7c86f0e35a1fb2ce2158ea65f8bafec54c479737a
cloud@ubuntu14044:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
344d8e23d32a gitlab/gitlab-ce:latest "/assets/wrapper" 10 seconds ago Up 6 seconds 0.0.0.0:222->22/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:444->443/tcp gitlab
(如果在启动容器是有端口占用的情况,可以修改转发的端口,先删除容器,再启动一个,参考升级GitLab 版本的步骤 http://docs.gitlab.com/omnibus/docker/#after-starting-a-container )
访问gitlib web
浏览器输入 http://IP
参考链接
http://doc.gitlab.com/omnibus/docker/
http://doc.gitlab.com/omnibus/docker/#after-starting-a-container