I am currently developping a toolchain for my company in which I've used Docker to set Gitlab and Jenkins.
I use the jwilder/nginx-proxy to access to them with a domain name from the outside.
My problem is that when I try to configure Jenkins to have access to my Gitlab, I am getting a time-out error. It seems like the container can't interact between them by using the domain name.
I have found this question that had the same problem as me, unfortunately, his solution didn't resolve my problem.
Do you have any idea how I could make Jenkins get acces to Gitlab by using the domain name ?
Edit :
Here is my docker-compose file
version: '3'
services:
nginx:
container_name: nginx
restart: always
image: jwilder/nginx-proxy:latest
ports:
- 80:80
- 443:443
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /home/nginx/certs:/etc/nginx/certs:ro
- /var/run/docker.sock:/tmp/docker.sock
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
letsencrypt:
container_name: letsencrypt
restart: always
image: jrcs/letsencrypt-nginx-proxy-companion:latest
depends_on:
- nginx
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /home/nginx/certs:/etc/nginx/certs:rw
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- NGINX_DOCKER_GEN_CONTAINER=nginx
gitlab:
container_name: gitlab
restart: always
image: gitlab/gitlab-ce:latest
hostname: gitlab
volumes:
- /home/gitlab/config:/etc/gitlab
- /home/gitlab/logs:/var/logs/gitlab
- /home/gitlab/data:/var/opt/gitlab
environment:
- VIRTUAL_HOST=gitlab.domain.biz
#- VIRTUAL_PORT=443
#- VIRTUAL_PROTO=https
- LETSENCRYPT_HOST=gitlab.domain.biz
- LETSENCRYPT_EMAIL=dev@domain.com
jenkins:
container_name: jenkins
restart: always
image: jenkins:alpine
volumes:
- /home/jenkins/jenkins_home:/var/jenkins_home:z
environment:
- VIRTUAL_HOST=jenkins.domain.biz
- VIRTUAL_PORT=8080
- LETSENCRYPT_HOST=jenkins.domain.biz
- LETSENCRYPT_EMAIL=dev@domain.com
volumes:
conf:
vhost:
html:
networks:
default:
external:
name: toolchain
Edit 2:
Message d'erreur du nginx-proxy :
nginx | nginx.1 | 2017/07/12 12:45:33 [error] 79#79: *356 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: jenkins.domai1n.biz, request: "GET /descriptorByName/github-plugin-configuration/checkHookUrl?value=https%3A%2F%2Fjenkins.domain.biz%2Fgithub-webhook%2F HTTP/2.0", upstream: "http://172.18.0.7:8080/descriptorByName/github-plugin-configuration/checkHookUrl?value=https%3A%2F%2Fjenkins.domain.biz%2Fgithub-webhook%2F", host: "jenkins.domain.biz", referrer: "https://jenkins.domain.biz/configure"
Message d'erreur dans Jenkins : Image of the error in Jenkins