G
G
gagareg2020-04-27 20:48:20
Domain Name System
gagareg, 2020-04-27 20:48:20

How to fix Failed to connect to gitlab-web port 80 in gitlab?

Good afternoon, I get the following error when deploying:

Fetching changes with git depth set to 50...
 Reinitialized existing Git repository in /builds/isamarskiy/ci-cd-test/.git/
 fatal: unable to access 'http://gitlab-web/isamarskiy/ci-cd-test.git/': Failed to connect to gitlab-web port 80: Operation timed out


It's funny, but if you start a new job and return to the previous one, then the error will change as follows:

Fetching changes with git depth set to 50...
 Reinitialized existing Git repository in /builds/isamarskiy/ci-cd-test/.git/
 fatal: unable to access 'http://gitlab-web/isamarskiy/ci-cd-test.git/': Could not resolve host: gitlab-web


docker-compose.yml

version: "3.3"

services:
  gitlab-web:
    image: gitlab/gitlab-ce:latest
    container_name: gitlab-web
    hostname: gitlab-web
    volumes:
      - "./gitlab-config:/etc/gitlab"
      - "./gitlab-logs:/var/log/gitlab"
      - "./gitlab-data:/var/opt/gitlab"
    ports:
      - "80:80"
      - "443:443"
      - "22:22"
    networks:
      - gitlab-network

  gitlab-runner-1:
    image: gitlab/gitlab-runner:latest
    container_name: gitlab-runner-1
    hostname: gitlab-runner-1
    volumes:
      - "./gitlab-runner-1-config:/etc/gitlab-runner:Z"
      - "/var/run/docker.sock:/var/run/docker.sock"
    networks:
      - gitlab-network

networks:
  gitlab-network:
    ipam:
        driver: default
        config:
            - subnet: 192.168.1.0/24


Data received by docker inspect...

192.168.1.1 - gateway
192.168.1.2 - gitlab-web
192.168.1.3 - gitlab-runner-1


/etc/gitlab-runner/config.toml file from gitlab-runner
[email protected]:/# cat /etc/gitlab-runner/config.toml 
concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800


  name = "gitlab-runner-1"
  url = "http://gitlab-web/"
  token = "oydJNWxbzkMWokLTJAxy"
  executor = "docker"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
  [runners.docker]
    extra_hosts = ["gitlab-web:192.168.1.2"]
    tls_verify = false
    image = "alpine:3.7"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0


/etc/hosts file for gitlab -runner-1
[email protected]:/# cat /etc/hosts
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.1.2     gitlab-runner-1
192.168.1.3     gitlab-web

Here you can see that port 80 is running on gitlab-web
[email protected]:/# lsof -i -P -n 
COMMAND PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
sshd     25 root    3u  IPv4 301788      0t0  TCP *:22 (LISTEN)
sshd     25 root    4u  IPv6 301789      0t0  TCP *:22 (LISTEN)
nginx   340 root    7u  IPv4 305451      0t0  TCP *:80 (LISTEN)
nginx   340 root    8u  IPv4 305452      0t0  TCP *:8060 (LISTEN)


You can also see that the request is working on port 80.
[email protected]:/# curl http://gitlab-web/isamarskiy/ci-cd-test.git/
<html><body>You are being <a href="http://gitlab-web/isamarskiy/ci-cd-test">redirected</a>.</body></html>

How can this be fixed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
foxyhunt, 2020-05-02
@foxyhunt

Let's start with a simple one is port 80 available?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question