Docker container cannot resolve request to service in another container

I’m running gitlab-ce and gitlab-ci-multi-runner in separated docker containers, but on the same server.

Gitlab CE works fine, I can access it via browser and clone projects using both http and ssh.

  • How to connect microservice to SQS/SNS
  • Passing docker container IP address to container
  • Timeouts accessing services on swarm published ports
  • Symfony Application on AWS ECS with a data-only container - Is this the right direction?
  • Random tag applied to every git commit
  • Change “hosts” / “-h” Docker for Windows in daemon.json
  • However my runner cannot connect to Gitlab using domain/server ip. It can connect to it only via local docker network (for example using ip address 172.17.0.X or, if linked, by using service alias).

    Ping to domain/server ip returns response.

    I tried to link it as gitlab:example.domain.com but it didn’t work, as somehow runner resolved server ip address instead of local network address

     Checking for builds... failed: couldn't execute POST against http://example.domain.com/ci/api/v1/builds/register.json: Post http://example.domain.com/ci/api/v1/builds/register.json: dial tcp server.ip:80: i/o timeout
    

    @Edit

    docker-compose.yml

    gitlab:
      image: gitlab/gitlab-ce:8.2.2-ce.0
      hostname: domain.name 
      privileged: true
      volumes:
        - ./gitlab-config:/etc/gitlab
        - ./gitlab-data:/var/opt/gitlab
        - ./gitlab-logs:/var/log/gitlab
      restart: always
      ports:
        - server.ip:22:22
        - server.ip:80:80
        - server.ip:443:443
    runner:
      image: gitlab/gitlab-runner:alpine
      restart: always
      volumes:
       - ./runner-config:/etc/gitlab-runner
       - /var/run/docker.sock:/var/run/docker.sock
    

    I have no clue what’s the issue here.
    I’d appreciate your help.
    Thanks in advance! 🙂

  • Datadog-agent spun up within docker container outputs JMX RMI connection error
  • How to pass parameters to a .net core project with dockerfile
  • How can Docker run distros with different kernels?
  • Run multiple docker compose
  • Dynamically get docker version during image build
  • Save docker-compose logs to a file
  • One Solution collect form web for “Docker container cannot resolve request to service in another container”

    Seems like it was a firewall problem. Unlocking docker0 interface allowed traffic from containers 🙂

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.