Caddy v2 docker in unraid

1. Caddy version (caddy version):

I’m running the caddy v2 docker

2. How I run Caddy:

I’m currently using caddy on windows as a reverse proxy. I’m migrating hosts and switching over to unraid. I have the caddy docker up and running just not sure where to start.

a. System environment:

Docker you on unraid

b. Command:

paste command here

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

paste config here, replacing this text
DO NOT REDACT anything except credentials

3. The problem I’m having:

4. Error messages and/or full log output:

5. What I already tried:

6. Links to relevant resources:

Well I’m not sure where to start either, you didn’t really give any information about your setup. Not sure what you expect us to tell you here…

Cool. Thanks for replying.

On windows once I had caddy up and running I just created a json file and when I started the service caddy did everything for me and it’s been amazing!

Now that I’m setting up this docker I’m unsure of how to create the caddyfile so that caddy can be just as amazing but now running in a container.

I’m not trying to be vague it’s just I can’t find any documentation on how to configure this docker to work as a reverse proxy. I really love caddy and have recommended it to everyone and their brother but I’m a life long windows guy taking the docker plunge.

The README for docker is here: https://hub.docker.com/_/caddy/

You should be able to figure out how to configure Caddy from there on using the official docs:

thanks again for your help! i figured i could just drop in my caddy file and start the container but when i browse to the directory in the documentation there is no caddy folder.

so i created the path /etc/caddy and dropped in my Caddyfile. I then ran caddy fmt /etc/caddy/Caddyfile and got an error stating no such file exists.

Then I edited the file by using cli and vi. Did a caddy reload and now it looks like it does a forced https but isn’t proxying back to where it should be.

You can ignore this. I’ve figured out my issue and it’s now working again.

What was the solution? So others who search for it can find an answer.

In unraid all of my dockers install to /mnt/user/appdata/ but I couldn’t find the files for the caddy docker. In the documentation for caddy I saw mention of /etc/caddy/caddyfile for the location of the file. I browsed out to that location but it didn’t exist. So under /etc/ I created the caddy folder then copied over my existing caddyfile. Then I just ran the caddy command to point to my caddyfile. It’s been working great since. I’m just not sure if that file will ever get over written so I have a backup handy.

2 Likes

To Brian and others that may have questions in the future:
There is an unRaid Docker template for Caddy. This gives all the required ports/volumes so they are more easily identified.

Just add the following to “Template Repositories” under the “Docker” tab in unRAID: