Gitlab with Docker and behind NGINX

On my server I host everything in a separate docker container and behind the nginx proxy manager.
I have a few issues:

  • The GitLab container still uses port 22 but in nginx I configured a stream that maps port 2222 to the container on port 22. How can I change the URL within GitLab to say mydomain.com:2222/project.git but still uses port 22?
  • I have a wildcard certificate for all my subdomains so the gitlab container should run in http mode so it doesn’t request a ssl certificate (external_url ‘http://gitlab.mydomain.com’). The connection to nginx is over https. How can I make the URL in GitLab say https butt doesn’t request a certificate?

SOLVED IT:

services:
gitlab-server:
image: ‘gitlab/gitlab-ce:latest’
container_name: gitlab-server
restart: unless-stopped
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url ‘https://gitlab.mydomain.com
gitlab_rails[‘gitlab_shell_ssh_port’] = 2222
letsencrypt[‘enabled’] = false
nginx[‘enable’] = true
nginx[‘listen_port’] = 80
nginx[‘listen_https’] = false
volumes:
- ‘./data/config:/etc/gitlab’
- ‘./data/logs:/var/log/gitlab’
- ‘./data/data:/var/opt/gitlab’
shm_size: ‘256m’

In my NGINX Reverse Proxy container I added a proxy to gitlab-server:80 over http and a stream from 2222 to gitlab-server:22

1 Like

Solved it!