Reputation: 128
I have an VPS (OVH) with Debian 9 and I'm trying to create something like this:
When I'm trying to connect via https everything works great. But when I'm trying to clone repository via SSH it fail.
This is my docker-composer.yml file:
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: [email protected]
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:
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.
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?
Upvotes: 3
Views: 1554
Reputation: 2970
It's not nginx that should handle the ssh connections, but an SSH daemon. So the Gitlab docker should also run an SSH daemon, which could listen on port 2222 if available.
Upvotes: 1