I 'm trying to setup a caddy reverse proxy within Docker and I am following the guide in this YouTube video
https://www.youtube.com/watch?v=qj45uHP7Jmo but when I the run docker compose up -d command I get this error:
failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/Joe/container/caddy/Caddyfile" to rootfs at "/etc/caddy/Caddyfile": create mountpoint for /etc/caddy/Caddyfile mount: cannot create subdirectories in "/var/lib/docker/overlay2/49e15938cd9c418a331b963f6fbbd3bba726b28748113ee8d028f6adf034b525/merged/etc/caddy/Caddyfile": 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
I am a bit perplexed on what I am doing wrong so any advice would be appreciated!
16 Comments
roofuskit@lemmy.world · 7 pts · 1y
Can you share your compose file? You should be able to paste into code blocks in a comment or your original post. It's likely you've yamld something wrong.
funkajunk@lemm.ee · 9 pts · 1y
Sounds like a bad prank show
YOU GOT YAML'D! 🤪
banshee@lemmy.dbzer0.com · 5 pts · 1y
WubbyGeth@lemmy.world · 2 pts · 1y
I do but I am wondering if the syntax in my caddyfile is wrong.
I did get past my initial error thanks to this group but I cannot get to my portainer via host name still.
Xanza@lemm.ee · 5 pts · 1y
Caddy can format caddyfiles;
enemenemu@lemm.ee · 1 pts · 1y
You can format it automatically
funkajunk@lemm.ee · 4 pts · 1y
I have always had trouble whenever I tried mounting files, and it seems that you're getting the same error, "not a directory".
Stick to mounting directories and you should be fine
/home/Joe/container/caddy:/etc/caddyWubbyGeth@lemmy.world · 4 pts · 1y
Here is my YAMLD YAML haha
version: '3.3' networks: caddy: services: portainer: image: portainer/portainer-ce:latest container_name: portainer2 restart: unless-stopped security_opt: - no-new-privileges:true volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - /home/Joe/containers/portainer/portainer-data:/data networks: - caddy ports: - 9000:9000
caddy: image: caddy:latest restart: unless-stopped container_name: caddy ports: - 80:80 - 443:443 volumes: - /home/Joe/container/caddy/Caddyfile:/etc/caddy/Caddyfile - /home/Joe/container/caddy/site:/srv - /home/Joe/container/caddy/caddy_data:/data - /home/Joe/container/caddy/caddy_config:/config networks: - caddy volumes: caddy_data:
HelloRoot@lemy.lol · 6 pts · 1y
The error suggests that you're trying to mount a file (
Caddyfile) onto a directory or vice versa. Let's debug this step by step.Steps to Fix:
Check if the path exists and is correct Run:
Ensure correct permissions
Check YAML Formatting
Your
docker-compose.ymlseems to have incorrect indentation and improper quotes aroundversion. Here's a fixed version:Restart Docker and Try Again
If the error persists, check
docker logs caddyfor additional hints.badlotus@discuss.online · 12 pts · 1y
Seems like AI wrote this. And did a good job!
enemenemu@lemm.ee · 3 pts · 1y
I was successful in installing and using caddy directly on my host instead of podman (docker).
Edit: someone doesn't like that I succeeded at it ...
WubbyGeth@lemmy.world · 1 pts · 1y
Thank you everyone for your help!
I elected to start from scratch and use nginx and have come across another issue that I am hoping someone can shed some light on.
I can get to my Audiobookshelf perfectly from the web but when I try to reach my portainer it just re-directs to my audiobookshelf container.
When I disable audiobookshelf and attempt access my portainer I now get error code 521 website down. I am not sure what I misconfigured.
muntedcrocodile@lemm.ee · -3 pts · 1y
Ik this sounds like a stackoverflow kind of thing to say but why u using caddy not nginx?
Edit: I've uploaded my nginx config if you would like to take a look https://github.com/muntedcrocodile/nginxconf
roofuskit@lemmy.world · 6 pts · 1y
Caddy is growing in popularity and finding its ways into more and more tutorials. Traefik and Caddy seem to be found in more reverse proxy tutorials/docs than NPM anymore. Forget about SWAG these days.
fatalicus@lemmy.world · 5 pts · 1y
Because caddy has built in, and default enabled, SSL of all sites using letsencrypt, something nginx doesn't have from what I can see.
muntedcrocodile@lemm.ee · 1 pts · 1y
Nginx does not have default SSL but the example I've uploaded has its quite a simple setup and gives you far greater control and modularity.
funkajunk@lemm.ee · 0 pts · 1y
nginx >>>>>