Problem running my site with caddy

Dont understand how to do it, if I use
docker exec -i -t caddyssl_ssl-reverse-proxy_1 sh
curl is not recognized?

Try Wget instead maybe? Depends on what’s available inside the container, some of them (including Abiosoft’s image) don’t come with cURL. We just want to see what it looks like from Caddy’s perspective when it tries to access the upstream.

wget -S -O /dev/null localhost:9000

you are a wizard :slight_smile:

/srv # wget -S -O /dev/null localhost:9000
Connecting to localhost:9000 (127.0.0.1:9000)
wget: can't connect to remote host (127.0.0.1): Connection refused

Im not sure what can possible be blocking/closed?

OK, one last check to make, should nail down what the problem is.

Lets go with: docker exec -it caddyssl_ssl-reverse-proxy_1 netstat -tulpn

Let me know if you see your service on port 9000 from earlier:

tcp        0      0 :::9000                 :::*                    LISTEN      -

from default docker-machine right?

docker@default:~$ docker exec -it caddyssl_ssl-reverse-proxy_1 netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.11:45535        0.0.0.0:*               LISTEN      -
tcp        0      0 :::443                  :::*                    LISTEN      16/caddy
tcp        0      0 :::80                   :::*                    LISTEN      16/caddy
udp        0      0 127.0.0.11:33809        0.0.0.0:*                           -
docker@default:~$

Yep, exactly.

So, you’ll note that there’s no :::9000 local address listening there.

Because Caddy’s in a container, it doesn’t see whatever’s running on the Docker host - only what’s running inside the container with it - because container networking is isolated and bridged by default.

There’s a few ways you can get around that. One would be to change the proxy upstream target from localhost:9000 to [docker-host-ip]:9000.

Another would be to use net=host on the Caddy container, and then localhost will work. I won’t go into detail on how to do that one, because there’s a number of other caveats you’ll want to know about first - you can read up on it here: Networking overview | Docker Documentation

thank you very much for your awesome help, net=host seems unfortunately not to be an option with docker toolbox.

I’ve added the portainer container to the same networks as caddy, and tried both localhost and the ip but doesn’t seen to work:

What do you mean by doesn’t seem to work?

Specifically, when troubleshooting a problem, try to answer three questions: what did I do, what did I expect, and what happened instead?

Do you get a result from wget -S -O /dev/null 192.168.99.100:9000?

Does the IP address 192.168.99.100 differ from the IP address of the computer you’re running Docker Toolbox on?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.