目录
一、docker 下安装(windows)
二、使用配置
1、查找gitlab的安装包
docker search gitlab
显示结果:
gitlab/gitlab-ce GitLab Community Edition docker image based … 3568 [OK]
gitlab/gitlab-runner GitLab CI Multi Runner used to fetch and run… 776 [OK]
gitlab/gitlab-ee GitLab Enterprise Edition docker image based… 316
gitlab/gitlab-runner-helper 37
gitlab/dind The image is deprecated and will be not upda… 33 [OK]
gitlab/gitlab-ce-qa GitLab QA has a test suite that allows end-t… 8
bitnami/gitlab-runner 5
gitlab/cog GitLab Bundle for Cog 4
gitlab/gitlab-dns Managing GitLab's External DNS 2
gitlab/postgres Allows GitLab employees to send read only qu… 2
gitlab/gitlab-ee-qa GitLab QA has a test suite that allows end-t… 2
mastertinner/gitlab-merge-request-resource A concourse resource to check for new merge … 2 [OK]
gitlab/gitlab-performance-tool GitLab QA performance test tool - https://gi… 1
gitlab/ssh-tunnel https://gitlab.com/gitlab-org/quality/ssh-tu… 1
gitlab/pagerbot 1
okteto/gitlab 0
gitlabtools/gitlab-ldap-group-sync 0
circleci/gitlab-single-org-connector CircleCI GitLab Connector Demonstration 0
gitlab/cog_chef 0
bitnami/gitlab-runner-helper 0
gitlab/gpt-data-generator The GPT Data Generator creates all test data… 0
gitlab/ymir 0
gitlab/gitlab-qa GitLab QA has a test suite that allows end-t… 0
gitlabcibuild/test-elastic-image See https://gitlab.com/gitlab-org/test-elast… 0
gitlabelinvar/dind dind 0
2、拉取镜像
docker pull gitlab/gitlab-ce:12.3.5-ce.0
3、运行镜像
docker run -d -p 7080:80 -p 7443:443 -p 7022:22 -v /home/gitlab/config:/etc/gitlab -v /home/gitlab/logs:/var/log/gitlab -v /home/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce
# -d:后台运行
# -p:将容器内部端口向外映射
# --name:命名容器名称
# -v:将容器内数据文件夹或者日志、配置等文件夹挂载到宿主机指定目录
# -d:后台运行
# -p:将容器内部端口向外映射
(7080指的是本机地址,80指的是Docker下的服务地址)
# --name:命名容器名称
# -v:将容器内数据文件夹或者日志、配置等文件夹挂载到宿主机指定目录
此时就可以正常访问,但无法登录(缺少Root密码)
二、获取登录信息密码
1、查询正执行的容器状态
docker ps -a
显示以下结果
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d74ed1c53290 gitlab/gitlab-ce "/assets/wrapper" 4 hours ago Exited (137) 3 hours ago mystifying_chaplygin
2、使用docker 操作容器内的系统
(1)查看系统的文件
docker exec -it d74ed1c53290 ls /
#docker exec
Docker 操作命令
docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
OPTIONS说明:
-d :分离模式: 在后台运行
-i :即使没有附加也保持STDIN 打开
-t :分配一个伪终端
#d74ed1c53290
容器编号
#ls /
Linux 操作命令 ,此处意思是查看根目录的目录结构
操作结果:
RELEASE bin dev home lib32 libx32 media opt root sbin sys usr
assets boot etc lib lib64 linuxrc mnt proc run srv tmp var
(2)获取root密码
docker exec -it d74ed1c53290 vi /etc/gitlab/initial_root_password
操作结果:
PS C:\Users\lizehua> is valid only in the following conditions
# 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial
# 2. Password hasn't been changed manually, either via UI or via command line.
# If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/
Password: (密码)
# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.