Error: mounting caddy_config/Caddyfile to rootfs at 'etc/caddy/Caddyfile'

FIXED:
the command docker-compose up -d apparenty creates a sibling folder to the n8n-docker-caddy called n8n-digital-ocean. This directory also has a caddy_config folder with a Caddyfile directory in it, probably created when i ran the command without moving the Caddyfile from local_files to caddy_config (see below).
SOLUTION

  1. make sure the Caddyfile is in the caddy_config directory in n8n-docker-caddy.
  2. delete the Caddyfile directory from n8n-digital-ocean/caddy_config
  3. run docker-compose up -d again.

Describe the issue/error/question

I’m following the instructions at https://docs.n8n.io/hosting/server-setups/digital-ocean/#configure-caddy and I’m running into an issue that is maybe related to the fact that the Caddyfile is not where the guide says it should be (in /caddy_config) but in /local_files. (see github repo )

When I run docker-compose up -d I get an error, apparently related to mounting the Caddyfile to the docker image config.

What is the error message (if any)?

root@n8n-myservername:~/n8n-docker-caddy# docker-compose up -d
Starting n8n-docker-caddy_caddy_1 ...
Starting n8n-docker-caddy_caddy_1 ... error

ERROR: for n8n-docker-caddy_caddy_1  Cannot start service caddy: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/root/n8n-digital-ocean/caddy_config/Caddyfile" to rootfs at "/etc/caddy/Caddyfile" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for caddy  Cannot start service caddy: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/root/n8n-digital-ocean/caddy_config/Caddyfile" to rootfs at "/etc/caddy/Caddyfile" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.

attempted solutions:

  1. copied, and also moved Caddyfile from local_files to caddy_config

attempting to run n8n in docker with caddy on digital ocean, debian 11 as root.

I struggled with this on setup - between 2 caddyfiles and C vs c.
Here is what worked for me
in docker-compose
volumes:
- ${DATA_FOLDER}/caddy_data:/data
- ${DATA_FOLDER}/caddy_config:/config
- ${DATA_FOLDER}/caddy_config/Caddyfile:/etc/caddy/Caddyfile

Files and folders
image

Hi @treyr, welcome to the community!

I’m really sorry for the trouble you had, please accept my apologies for this.

the command docker-compose up -d apparenty creates a sibling folder to the n8n-docker-caddy called n8n-digital-ocean. This directory also has a caddy_config folder with a Caddyfile directory in it, probably created when i ran the command without moving the Caddyfile from local_files to caddy_config (see below).

I’ll make sure to pass this on to the docs team.

1 Like

@MutedJam have alerted the dev who maintains the repo and she has fixed the issue.

1 Like

I deleted the Caddyfile folder/directory and still get the same error. How can I fix this?

Hi @LinkedUp_Online, welcome to the community :tada:

I am not 100% sure since the documentation has changed from the looks of it, so I don’t know your current status. If you’re just getting started it might be worth simply deleting your droplet and starting from a fresh state.

Personally, I usually to keep the web server out of docker and simply have the configuration file in it’s default location on the host. I wrote a small tutorial on this a while back. It’s not specific to Digital Ocean but might still be useful for you.

Hi! I deleted everything, and started over. The initial solution did it. Cheers!

1 Like

I did the described procedure, but still the error remains.

Hey @Rafael_Rocha,

Welcome to the community :raised_hands:

What user are you running the commands as? It looks like if you use root it can cause issues.

I’m testing through digital ocean. When I access the console, I’m already logged in as root.

I achieved. The error was the contents of the “docker-compose.yml” file. This file came from the clone in version 3.7, I deleted its contents and copied what is in the documentation in version 3. I started docker and it ran fine.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.