[英]docker-compose + nginx-proxy + letsencrypt-nginx-proxy-companion + gitlab-ce = SSH Connection fail on git clone
I have an VPS (OVH) with Debian 9 and I'm trying to create something like this: 我有一个使用Debian 9的VPS(OVH),我正在尝试创建这样的东西:
When I'm trying to connect via https everything works great. 当我尝试通过https连接时,一切都很好。 But when I'm trying to clone repository via SSH it fail.
但是,当我尝试通过SSH克隆存储库时,它失败了。
This is my docker-composer.yml file: 这是我的docker-composer.yml文件:
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- "/etc/nginx/vhost.d"
- "/usr/share/nginx/html"
- "/var/run/docker.sock:/tmp/docker.sock:ro"
- "/etc/nginx/certs"
letsencrypt-nginx-proxy-companion:
image: jrcs/letsencrypt-nginx-proxy-companion
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
volumes_from:
- "nginx-proxy"
gitlab:
image: 'gitlab/gitlab-ce'
restart: always
container_name: gitlab
hostname: 'gitlab.example.com'
environment:
VIRTUAL_HOST: gitlab.example.com
LETSENCRYPT_HOST: gitlab.example.com
LETSENCRYPT_EMAIL: admin@example.com
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab.example.com'
volumes:
- '/srv/gitlab/config:/etc/gitlab'
- '/srv/gitlab/logs:/var/log/gitlab'
- '/srv/gitlab/data:/var/opt/gitlab'
gitlab-runner:
image: gitlab/gitlab-runner
container_name: gitlab-runner
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./conf:/etc/gitlab-runner
restart: always
I think, that I won't be able to connect via port 22 so I might need to add to Omnibus config this line: 我想,我将无法通过端口22连接,所以我可能需要添加到Omnibus配置这一行:
gitlab_rails['gitlab_shell_ssh_port'] = 2222
Unfortunately, when I'm trying to add port "2222:2222" to nginx-proxy and/or to gitlab container there is information, that port 2222 is already used. 不幸的是,当我尝试将端口“2222:2222”添加到nginx-proxy和/或gitlab容器时,有信息,端口2222已经被使用。
What is best way to configure this stack so when I connect to VPS (example.com) I'll connect to Debian, but when gitlab (gitlab.example.com) I'll be able to clone repository? 什么是配置此堆栈的最佳方式,所以当我连接到VPS(example.com)时,我将连接到Debian,但是当gitlab(gitlab.example.com)我将能够克隆存储库?
It's not nginx that should handle the ssh connections, but an SSH daemon. 它不是应该处理ssh连接的nginx,而是一个SSH守护进程。 So the Gitlab docker should also run an SSH daemon, which could listen on port 2222 if available.
所以Gitlab docker也应该运行一个SSH守护进程,如果可用,它可以监听端口2222。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.