Extreme Beginner, just looking to redirect ports


(Matt Thomas) #21

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


(Matthew Fay) #22

Volumes and ports, that’s all you need, 99% of the time! :smiley: Can’t recommend Compose enough, though, if you ever get the itch to move away from Portainer.

Glad to hear you’ve got some success now. Let us know if you run into any other trouble, want any tips or advice, etc.


(Matt Thomas) #23

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…


(Matthew Fay) #24

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.


(Matt Thomas) #25
USER@tt-ha:~$ docker exec -it caddy wget -qS http://hassio:8123/
wget: bad address 'hassio:8123'

If I manually go to hassio:8123 then my hassion install works just fine.

USER@tt-ha:~$ docker logs --tail 20 caddy
2018/06/22 14:39:32 [INFO] Successfully loaded TLS assets from /srv/domain.com.crt and /srv/domain.com.key
Activating privacy features... done.
https://hassio.domain.com
2018/06/22 14:39:32 https://hassio.domain.com    2018/06/22 14:39:38 [NOTICE] Sending telemetry: we were too early; waiting 55m29.919341379s before trying again
2018/06/22 15:35:08 [INFO] Sending telemetry: success
2018/06/22 15:39:32 [INFO] Scanning for stale OCSP staples
2018/06/22 15:39:32 [INFO] Done checking OCSP staples
2018/06/22 15:42:34 [INFO] SIGTERM: Shutting down servers then terminating
2018/06/22 15:42:36 [INFO] Successfully loaded TLS assets from /srv/domain.com.crt and /srv/domain.com.key
Activating privacy features... done.
https://hassio.domain.com
2018/06/22 15:42:36 https://hassio.domain.com
2018/06/22 15:42:46 [NOTICE] Sending telemetry: we were too early; waiting 54m47.452909869s before trying again
2018/06/22 15:44:27 [INFO] SIGTERM: Shutting down servers then terminating
2018/06/22 15:44:29 [INFO] Successfully loaded TLS assets from /srv/domain.com.crt and /srv/domain.com.key
Activating privacy features... done.
https://hassio.domain.com
2018/06/22 15:44:29 https://hassio.domain.com
2018/06/22 15:44:37 [NOTICE] Sending telemetry: we were too early; waiting 52m55.841751359s before trying again

(Matthew Fay) #26

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.


(Matt Thomas) #27

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?


(Matthew Fay) #28

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.


(Matt Thomas) #29

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.

Thank you for all your help!


(Matthew Fay) #30

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…