So this was it the entire time!!! Thank you so much!!! It is working now. So now I just need to get back to my docker container so Im not using precious RAM in my ESXi server.
So on my docker image I am using Portainer as a crutch. Basically I am running it with a few mapped volumes and ports but not much else.
My ports are
2015/2015
80/80
443/443
My volumes are:
HOST: /opt/caddy/Caddyfile to Caddy: /etc/Caddyfile
HOST: /opt/caddy/.caddy to Caddy: /root/.caddy
HOST: /opt/caddy/srv to Caddy: /srv
Of course. My luck and the docker container doesnt work…I’m getting a 502 Bad Gateway.
Both my Caddy and Hassio are on the same docker host. I used the exact same Caddyfile, except for changing the listening URL from test-hassio to hassio.
EDIT: Sorry for the delay in replying, apparently I hit some limit and had to wait since I am a new account EDIT-EDIT: I tried proxy’ing to another service. It works on my Caddy VM but not my docker image…
When Caddy’s container is up, run docker exec -it caddy wget -qS http://hassio:8123/ and tell me what you get? (Replace caddy with the name of the Caddy container if appropriate)
Also, you can add log stdout and errors stdout to your Caddyfile and check docker logs --tail 20 caddy to see what it’s telling you about the 502s.
Hmm. You said you’re running Portainer… Off the top of my head, I believe it just uses docker run commands, so the containers might not be able to resolve each other by DNS.
Try docker exec -it caddy ping hassio. If you get nothing, you might need to look into a defined network or container links.
Crap, I’m trying to keep things straight here. hassio.domain.com is what I want to use to access my hassio install. HA is the docker Host.
OK so,
If I caddy ping hassio then I get replies.
If I caddy ping HA I get nothing back. Why wouldn’t a container be able to ping it’s host?
If I ping either hassio or HA from my computer, both come back to the same address like it should.
EDIT: I tried caddy ping unifi (My unifi controller on a different server) and got no replies. So something is not right…
Edit-squared: It is of course…DNS…If I type in the IP of the docker host. It works great. How do I pass on my internal DNS servers to my caddy image?
The Docker network controller provides recursive DNS services, usually.
Does Portainer let you create a Docker network and select it for use when you create a container? If so, give that a try, rather than the default network. I believe services on a custom network resolve each other by service name. This is certainly true of Compose projects.
I think the DNS issue is a host issue. I’m using a cheap-crap laptop so I think that is causing issues. Like instead of eth0 I have enp9s0 for my NIC. Just weird stuff like that.
Having your interface naming scheme as “enpXsY” rather than “ethX” is a feature of newer distros using systemd, I believe. I’m pretty sure it’s not a sign of the suitability of the hardware. Linux tends not to care too much about how cheap or old your gear is.
I won’t rule out a host DNS issue, though. I tend to like Compose projects because they set up a project-specific Docker network for you and it’s quite reliable on the inside. Downside is there’s still no hostname that resolves to the Docker host itself, though…