安装 GitLab 镜像:

  1. $ docker pull gitlab/gitlab-ce

创建并启动容器:

  1. $ docker run --detach \
  2. --hostname gitlab.example.com \
  3. --publish 443:443 --publish 80:80 --publish 22:22 \
  4. --name gitlab \
  5. --restart always \
  6. --volume /srv/gitlab/config:/etc/gitlab \
  7. --volume /srv/gitlab/logs:/var/log/gitlab \
  8. --volume /srv/gitlab/data:/var/opt/gitlab \
  9. gitlab/gitlab-ce:latest

若为 Windows 平台,在 Powershell 下换行使用 ``` 符号:

  1. $ docker run --detach `
  2. --publish 443:443 --publish 80:80 --publish 22:22 `
  3. --name gitlab `
  4. --restart always `
  5. --volume /srv/gitlab/config:/etc/gitlab `
  6. --volume /srv/gitlab/logs:/var/log/gitlab `
  7. --volume /srv/gitlab/data:/var/opt/gitlab `
  8. gitlab/gitlab-ce:latest

启动后登陆设置的 hostname,若未设置在为 localhost 或主机 IP,根据提示操作即可。

参考