docker
docker logs gitlab -f
.docker-compose.yml
version: '3.6'
services:
gitlab:
container_name: gitlab
image: gitlab/gitlab-ce:latest
hostname: 'gitlab.example.com'
restart: always
ports:
- 8443:443
- 22:22
volumes:
- /etc/localtime:/etc/localtime
- /data/gitlab/data:/var/opt/gitlab
- /data/gitlab/config:/etc/gitlab
- /data/gitlab/logs:/var/log/gitlab
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab.example.com'
gitlab_rails['gitlab_shell_ssh_port'] = 22
gitlab.example.com.conf
server {
listen 80;
server_name gitlab.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name gitlab.example.com;
ssl_certificate /etc/nginx/cert/gitlab.example.com_bundle.crt;
ssl_certificate_key /etc/nginx/cert/gitlab.example.com.key;
location / {
proxy_pass http://localhost:8443;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
nginx
nginx -t
nginx -s reload
gitlab
初始账号密码:root qN9EML8d+ST72xLRh**********OlVMYCxuP1c=
gitlab-app 令牌
glpat-Hx4PYSweY********C1os2BVk5nvsk
ssh秘钥
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABASSSAABgQC6QCUqFRks7B1kYcVriLkg63dKitdZ+VryNV/zwKujBJrglU2MVyrw30Xy3uGBpuLtsNh3uTqTAW8Q8FX8+wqgoivbh+7bo/qnzWlArg9DjZgcx2W2UwfKXVWArVDOQdhO3Zh/QXcFHJms6Nss7TaCqLNQPR8Q/govk+JrHS9WOSiwRsT3YGI7rdL9Fq+LlzCI71poNoVt**********************************************************ItcXEK65Js= xxxxx@gmail.cn
问题:gitlab克隆路径不对
docker exec -it gitlab /bin/bash
vi /etc/gitlab/gitlab.rb
external_url 'https://gitlab.example.com' # 这就是clone的地址
nginx['listen_port'] = 80 # 这个配置就是指定容器内的服务要监听80端口
gitlab_rails['gitlab_ssh_host'] = 'gitlab.example.com'' # ssh克隆地址
gitlab_rails['gitlab_shell_ssh_port'] = 22 # ssh克隆端口
gitlab-ctl reconfigure
gitlab-ctl restart // 这一步其实可以不用