我目前正在为我的公司开发一个工具链,其中我使用 Docker 来设置 Gitlab 和 Jenkins。
我使用jwilder/nginx-proxy从外部通过域名访问它们。
我的问题是,当我尝试配置 Jenkins 以访问我的 Gitlab 时,出现超时错误。似乎容器无法通过使用域名在它们之间进行交互。
我发现这个问题和我有同样的问题,不幸的是,他的解决方案并没有解决我的问题。
你知道如何让 Jenkins 通过使用域名来访问 Gitlab 吗?
编辑 :
这是我的 docker-compose 文件
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
编辑2:
消息 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 : Jenkins中的错误图像