Docker Community Forums

Share and learn in the Docker community.

[RESOLVED] Docker-Compose Port Forwarding

docker

#1

Good afternoon,

I am very confused… I have a docker-compose file for configuring an internal gitlab container on a linux server. In my docker compose, I have the ports set:

version: '3.4'
services:
   web:
      image: 'gitlab/gitlab-ce:latest'
      restart: always
      hostname: 'gitlab.internal.com'
      environment:
        GITLAB_OMNIBUS_CONFIG: |
          external_url 'https://gitlab.internal.com:8081'
          gitlab_rails['gitlab_shell_ssh_port'] = 8022
          unicorn['socket'] = '/opt/gitlab/var/unicorn/gitlab.socket'
          letsencrypt['enable'] = false
      ports:
        - '80:80'
        - '8081:443'
        - '8022:22'
      volumes:
        - '/srv/gitlab/config:/etc/gitlab'
        - '/srv/gitlab/logs:/var/log/gitlab'
        - '/srv/gitlab/data:/var/opt/gitlab'

When I try to connect to the host, the TLS connection is refused. However, when I drop into bash in the container itself, I can connect to the gitlab interface with curl on port 8081. I would think that inside the container I would connect to 443. 8081 is for externally connecting into the host, and then is passed through to 443 in the container.

I am very confused at why this is happening if anyone has any thoughts or could correct my understanding.

Thanks.

BCBB


#2

Yeah, definitely not paying attention. I configured gitlab to listen on 8081 in the container then mapped external 8081 to container 443. Arrrrg…