2

I'm not good at Docker and trying to install the configuration below on my localhost. I know that Gitlab Runner works over https so I've found a solution to use nginx-proxy. Here is my docker-compose.yml. It's not my conf, I just was trying to comment some lines to figure out what is wrong. After docker-compose up --build I get

2021/02/16 02:57:43 [error] 44#44: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 172.20.0.1, server: gitlab.my.test, request: "GET / HTTP/2.0", upstream: "http://172.20.0.4:8080/", host: "gitlab.my.test"
2021/02/16 02:57:43 [error] 44#44: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 172.20.0.1, server: gitlab.my.test, request: "GET /favicon.ico HTTP/2.0", upstream: "http://172.20.0.4:8080/favicon.ico", host: "gitlab.my.test", referrer: "https://gitlab.my.test/"
version: "3.0"

services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./export/containers/nginx/certs:/etc/nginx/certs
      - ./export/containers/nginx/logs:/var/log/nginx
    depends_on:
      - gitlab_app
    links:
      - gitlab_app
  gitlab_app:
    restart: always
    image: 'gitlab/gitlab-ce:latest'
    #hostname: 'git'
    container_name: gitlab_app
    expose:
      - "8081"
      - "8080"
    volumes:
     - "./export/containers/gitlab-config:/etc/gitlab"
     - "./export/containers/gitlab-data:/var/opt/gitlab"
     - "./export/containers/gitlab-logs:/var/log/gitlab"
    ports:
     - "8022:22"
    depends_on:
      - postgresql
      - redis
    links:
      - postgresql
      - redis
    environment:
      - VIRTUAL_HOST=gitlab.my.test
      - VIRTUAL_PORT=8080
  gitlab-runner:
    image: gitlab/gitlab-runner:latest
    #restart: unless-stopped
    depends_on:
      - gitlab_app
    volumes:
      - ./export/containers/gitlab-runner/config:/etc/gitlab-runner
      - ./export/containers/gitlab-runner/var/run/docker.sock:/var/run/docker.sock
    #networks:
    #  - gitlab
    #network_mode: "bridge"
  postgresql:
    restart: always
    image: postgres:latest
    container_name: postgresql
    environment:
     - POSTGRES_PASSWORD=T0pS3cr3T
    expose:
    - "5432"
    volumes:
     - "./export/containers/postgresql-data:/var/lib/postgresql/data"
    #network_mode: "bridge"
  redis:
    restart: always
    image: redis:latest
    container_name: redis
    expose:
    - "6379"
    volumes:
     - "./export/containers/redis-data:/data"
    #network_mode: "bridge"

I added 127.0.0.1 gitlab.my.test to the hosts file. And if I set network_mode: "bridge" to containers, I'll get:

2021/02/16 04:43:12 [error] 42#42: *2 no live upstreams while connecting to upstream, client: 172.20.0.1, server: gitlab.my.test, request: "GET / HTTP/2.0", upstream: "http://gitlab.my.test/", host: "gitlab.my.test"
2021/02/16 04:43:12 [error] 42#42: *2 no live upstreams while connecting to upstream, client: 172.20.0.1, server: gitlab.my.test, request: "GET /favicon.ico HTTP/2.0", upstream: "http://gitlab.my.test/favicon.ico", host: "gitlab.my.test", referrer: "https://gitlab.my.test/"
Evgeny Musonov
  • 181
  • 3
  • 9
  • Could you check if the port exposed by the gitlab docker container correspond to those listening with the docker container itself? Try to log into the container with `docker exec -it gitlab-app /bin/bash` Then run: `netstat tuln}` and please paste the output of it. – Kropot Sep 05 '21 at 21:50

0 Answers0