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.
Selfhosted
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
Rules:
-
Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.
-
No spam posting.
-
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.
-
Don't duplicate the full text of your blog or github here. Just post the link for folks to click.
-
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
-
No trolling.
Resources:
- selfh.st Newsletter and index of selfhosted software and apps
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
Sounds like a bad prank show
YOU GOT YAML'D! 🤪
Do you already have the file created and populated at '/home/Joe/container/caddy/Caddyfile' before running your up command?
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.
I do but I am wondering if the syntax in my caddyfile is wrong.
Caddy can format caddyfiles;
caddy fmt --overwrite /home/Joe/container/caddy/Caddyfile
caddy validate --config /home/Joe/container/caddy/Caddyfile --adapter caddyfile
You can format it automatically
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:
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:
ls -ld /home/Joe/container/caddy/Caddyfile
- If it’s a directory, it should be a file instead.
- If it doesn’t exist, create an empty one:
touch /home/Joe/container/caddy/Caddyfile
-
Ensure correct permissions
chmod 644 /home/Joe/container/caddy/Caddyfile
-
Check YAML Formatting
Yourdocker-compose.yml
seems to have incorrect indentation and improper quotes aroundversion
. Here's a fixed version: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
-
Restart Docker and Try Again
docker compose down docker compose up -d
If the error persists, check docker logs caddy
for additional hints.
Seems like AI wrote this. And did a good job!
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 ...
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/caddy
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've purchased a domain.
- configured CloudFlare to use as my DNS.
- set up a CNAME for my two test containers.
- set up my SSL cert in nginx
- forwarded the proper ports on my router for my test containers.
- Configured two hosts. AudioBookShelf and Portainer
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.
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
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.
Because caddy has built in, and default enabled, SSL of all sites using letsencrypt, something nginx doesn't have from what I can see.
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.
nginx >>>>>