-
Caddy version (
caddy version
):
v2.3.0 -
How I run Caddy:
docker run --name caddy -d -p 80:80 -p 443:443 -p 2019:2019 -p 6984:6984 -p 8443:8443 -v /home/caddy/blendedapplication:/srv -v /home/caddy/data:/data -v /home/caddy/config:/config -v /home/caddy/caddyfile/Caddyfile:/etc/caddy/Caddyfile caddy
a. System environment:
Ubuntu 18.04.5 LTS + Docker 20.10.5 + container --name keycloak port 8080 _ container --name couchdb port 5984
d. My complete Caddyfile or JSON config:
{
admin 0.0.0.0:2019 {
}
}
:6984 {
reverse_proxy couchdb:5984
}
:8443 {
reverse_proxy keycloak:8080
}
- The problem I’m having:
I want to resolve my running and working keycloak container on 8080 through 8443 and my running and working couchdb container on 5984 through 6984.
curl -v localhost:8443 and curl -v localhost:6984 both give HTTP/1.1 502 Bad Gateway Server: Caddy
I can see from the logs that it is likely Docker networking which fails to resolve the IP of either couchdb or keycloak containers. But I am at a loss understanding why that is and how to solve it. I understand this is not Caddy specific, but it must be a very common scenario with possibly a simple resolution
- Error messages and/or full log output:
{"level":"info","ts":1618067998.530174,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
{"level":"info","ts":1618067998.5375714,"logger":"admin","msg":"admin endpoint started","address":"tcp/0.0.0.0:2019","enforce_origin":false,"origins":["0.0.0.0:2019"]}
{"level":"warn","ts":1618067998.5375843,"logger":"admin","msg":"admin endpoint on open interface; host checking disabled","address":"tcp/0.0.0.0:2019"}
{"level":"info","ts":1618067998.5381608,"msg":"autosaved config","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1618067998.5381708,"msg":"serving initial configuration"}
{"level":"info","ts":1618067998.5384357,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0001ff1f0"}
{"level":"info","ts":1618067998.538935,"logger":"tls","msg":"cleaned up storage units"}
{"level":"error","ts":1618068009.67327,"logger":"http.log.error","msg":"dial tcp: lookup couchdb on 168.63.129.16:53: no such host","request":{"remote_addr":"172.17.0.1:37232","proto":"HTTP/1.1","method":"GET","host":"localhost:6984","uri":"/","headers":{"User-Agent":["curl/7.58.0"],"Accept":["*/*"]}},"duration":0.017254921,"status":502,"err_id":"1gn1dkgjx","err_trace":"reverseproxy.statusError (reverseproxy.go:783)"}
{"level":"error","ts":1618068021.21765,"logger":"http.log.error","msg":"dial tcp: lookup keycloak on 168.63.129.16:53: no such host","request":{"remote_addr":"172.17.0.1:38734","proto":"HTTP/1.1","method":"GET","host":"localhost:8443","uri":"/","headers":{"User-Agent":["curl/7.58.0"],"Accept":["*/*"]}},"duration":0.141960895,"status":502,"err_id":"6dp8am5f3","err_trace":"reverseproxy.statusError (reverseproxy.go:783)"}
{"level":"error","ts":1618070510.6747932,"logger":"http.log.error","msg":"dial tcp: lookup couchdb on 168.63.129.16:53: no such host","request":{"remote_addr":"172.17.0.1:41114","proto":"HTTP/1.1","method":"GET","host":"localhost:6984","uri":"/","headers":{"User-Agent":["curl/7.58.0"],"Accept":["*/*"]}},"duration":0.027581793,"status":502,"err_id":"je65mnw27","err_trace":"reverseproxy.statusError (reverseproxy.go:783)"}
-
What I already tried:
Reading and rereading the docs/examples and issues. -
Links to relevant resources: