Howdy! Sorry if this is a supid question. I’ve been trying to get this working for like 5 days and I’ve been researching and reading docs, but I’m just not getting it. I’m fairly new to selfhosing and I’m trying to set up Jellyfin remote access on my NAS. My NAS is a QNAP product running QTS (which I absolutely hate). QTS uses their own weird version of Docker.
When I start Caddy with a docker compose file, I get an error that port 443 is in use and the container can’t be started. If I create a container in the Container Station app directly from the Docker Image, it starts up fine. Container Station handles environment variables in a dumb way so I am having trouble specifying the Caddyfile location when I do it that way.
Does anyone know why it works fine in that way but not the other? Both use port 443 but when I do it in a docker compose file, it says the port is in use but when I do it the other way, it doesn’t and starts fine.
Note: I know you can do this with Tailscale also, but I want to use my custom domain to make it easier for sharing in the future.
Hey, I’m just guessing here because I haven’t used Caddy in Docker directly, but I do manage a project that uses FrankenPHP, which is essentially a wrapper for Caddy as I understand it, and I’ve had a problem that looks similar to this.
Caddy will attempt to generate an SSL certificate, and if you are using a reverse proxy, depending on how it’s configured, it will internally attempt to fulfil that certificate generation over port 443, which will fail, because it doesn’t have a configured SSL certificate. It’s the old catch-22!
The solution I have found is to temporarily internally serve your environment over port 80 for external SSL connections. This will allow Caddy to retrieve an SSL certificate and put it in place. After this, you should then be able to switch back over to port 443 for SSL connections internally, and it’ll use the certificate.
Once again – this is just a guess, and I don’t know the exact criteria in getting this going in Caddy, but it might be worth a try. In my FrankenPHP project at least, it was a matter of setting the
SERVER_NAMEvariable tohttp://${DOMAIN}:80