1. docker 安装gitlab
docker search gitlab
docker pull gitlab/gitlab-ce
2. 启动gitlab
这里我们将Gitlab的配置,日志以及数据目录映射到了宿主机指定文件夹下,防止重新创建容器后丢失数据。
docker run --detach \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab \
--restart always \
--volume /mydata/gitlab/config:/etc/gitlab \
--volume /mydata/gitlab/logs:/var/log/gitlab \
--volume /mydata/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
如果本机端口443,80,22端口有被占用,则会出现如下提示,如果没有则跳过
[root@localhost config]# docker run --detach --publish 443:443 --publish 80:80 --publish 22:22 --name gitlab --restart always --volume /mydata/gitlab/config:/etc/gitlab --volume /mydata/gitlab/logs:/var/log/gitlab --volume /mydata/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:latest
f4c446ca56d3b36367cf613486c1986d09c1f1fe0dd99404db1cbbc86abbed8c
docker: Error response from daemon: driver failed programming external connectivity on endpoint gitlab (2d5155e4a0bb5edf906c1b1fb7788a8330aaf920aab6e0e170acb78bddc8d2fa): Error starting userland proxy: listen tcp 0.0.0.0:22: bind: address already in use.
如上,我远程登陆服务器