Caddy in Docker on Synology NAS

This says Caddy is responding:

This is because port 5858 isn’t port-forwarded on your router, so you need to forward this additional port if you truly want it to be served on this port.

Are you sure your docker config is configured correctly? To install caddy I run a bash script through SSH. I don’t use the docker UI in synology. It all depends on how you arranged the persistent storage. Like you I have a Docker directory. The tree looks like this:
image

My bash script looks like this:

#!/bin/bash

docker run -d \
	-p 2080:80 \
	-p 2443:443 \
	--name Caddy \
	--restart unless-stopped \
	-v /volume1/docker/Caddy/Data:/data \
	-v /volume1/docker/Caddy/Config:/config	\
	-v /volume1/docker/Caddy/Caddyfile:/etc/caddy/Caddyfile \
	caddy

As you can see, the Caddyfile goes into Docker/Caddy (on Volume1)

1 Like

It is forwarded, this is the exact same set up I used when hosting it from my windows machine too (those rules have been deleted):
image

Which makes me think it’s something on the synology that’s wrong

There are a bunch of files in this directory:


But I’m not sure how I can figure out if they’re stale, should I delete everything in the directory and restart the container?

Is your caddyfile set up to serve a reverse proxy? I may try this, but my caddyfile is working as I can get to the 443 and 80 responses, my current directory structure is this:
image
image

Is your caddyfile set up to serve a reverse proxy? I may try this, but my caddyfile is working as I can get to the 443 and 80 responses, my current directory structure is this:

Yes it is. I run a very basic setup where is host a website and a number of fileservers. The Caddyfile entry looks like this:

www.someserver.nl {
reverse_proxy * 192.168.3.201:5000
	log {
		output file /data/caddy-someserver.log {
			roll_keep_for 14d
		}
	}
}

This works quite well. There is one big snag though with running Caddy in docker. The original IP is not passed on to the container. It therefore is missing in the header which creates issues. I moved away from docker for Caddy this morning.

If you already have the port forwarded for that, then it’s:

The port 5858 isn’t exposed here.

2 Likes

THANK YOU! I have added the ports on to the container, and I also had to change localhost to the internal IP of my server in the caddyfile, but now I can access it remotely. Thanks so much for your help everyone!

This topic was automatically closed after 30 days. New replies are no longer allowed.