运行实例
docker run -itd --name gitlab -p 8443:443 -p 8080:80 -p 2222:22 --restart always -v /home/gitlab/config:/etc/gitlab -v /home/gitlab/logs:/var/log/gitlab -v /home/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce
# --hostname 指定容器域名,未知功能:创建镜像仓库时使用 # 将容器443端口映射到主机8443,提供https服务 # 将容器内80端口映射到主机8080,提供http服务 # 向主机2222提供容器22端口映射ssh服务
Unable to find image 'gitlab/gitlab-ce:latest' locally latest: Pulling from gitlab/gitlab-ce d7bfe07ed847: Pull complete edfb7a936d8c: Pull complete 90366048cf28: Pull complete 205ee59b56a4: Pull complete f756bb6c1805: Pull complete 566b4c651986: Pull complete 1538a0e5beec: Pull complete ede9471fbbd8: Pull complete Digest: sha256:66da8d58791cd55d0cb4b6bca80fd3d4c87780dd0b3af71fc3cf0c0d9e7011ad Status: Downloaded newer image for gitlab/gitlab-ce:latest daa311dbb4aab58b9114124075e54b997aa7e360b52319634820cd387a5e5721
查看Gitlab容器运行
docker inspect gitlab --format "{
{.State.Status}}"
running
登录Gitlab
http://xxx.xxx.xxx.xxx:8080/
初次使用gitlab时用root用户名登录,
用/home/gitlab/config/initial_root_password文件中的Password:,作为密码登录,登录账号后,修改为你自己的密码。然后用刚刚设置的密码,就可以以管理员身份登录Gitlab。