一.直接下载docker-ce
1.拉取gitlab/gitlab-ce
Randy:~ Randy$ docker pull gitlab/gitlab-ce
Using default tag: latest
2.运行gitlab/gitlab-ce,
Randy:~ Randy$ docker run -d --publish 8443:443 --publish 8001:80 --publish 8022:22 --name gitlab-randy --restart always gitlab/gitlab-ce
其中使用publish参数映射host主机上的8443到docker-ce上面的443端口,并制定使用bash。此处可以使用--volume参数来指定docker-ce中的文件到host主机上的路径以便于升级,此处仅作为测试使用。
3.验证http://127.0.0.1:8001/可以登录,首次登录需要修改密码
二.使用Docker-compose方式
这种方式是比较灵活,也是官方推荐的安装方式。实际上就是把启动docker的参数配置到文件中,并通过docker-compose up调用。步骤如下:
1. 下载docker-compose.yml文件(wget https://raw.githubusercontent.com/sameersbn/docker-gitlab/master/docker-compose.yml)
[root@randysun ~]# wget https://raw.githubusercontent.com/sameersbn/docker-gitlab/master/docker-compose.yml --2017-08-06 11:36:43-- https://raw.githubusercontent.com/sameersbn/docker-gitlab/master/docker-compose.yml Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.72.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.72.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 3836 (3.7K) [text/plain] Saving to: ‘docker-compose.yml’ 100%[============================================================================>] 3,836 --.-K/s in 0s 2017-08-06 11:36:44 (64.7 MB/s) - ‘docker-compose.yml’ saved [3836/3836]
2. 在第一步中下载好的文件路径下运行docker-compose up
[root@randysun ~]# docker-compose up Creating network "root_default" with the default driver Pulling postgresql (sameersbn/postgresql:9.6-2)... 9.6-2: Pulling from sameersbn/postgresql c60055a51d74: Downloading [=> ] 1.615MB/65.69MB 755da0cdb7d2: Download complete 969d017f67e6: Download complete 37c9a9113595: Download complete a3d9f8479786: Download complete e43d9de53575: Downloading [==================> ] 1.754MB/4.702MB cddf24084b61: Download complete f23b95c5f17c: Waiting 3965edbc705f: Waiting 4e6c393fb7f5: Waiting
3.验证