Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caddyfile file bind mount issues #364

Open
msladek opened this issue Aug 2, 2024 · 0 comments
Open

Caddyfile file bind mount issues #364

msladek opened this issue Aug 2, 2024 · 0 comments

Comments

@msladek
Copy link

msladek commented Aug 2, 2024

The current documentation suggests mounting the Caddyfile as a file:

volumes:
  - $PWD/Caddyfile:/etc/caddy/Caddyfile

This approach can lead to issues due to how Docker handles file binds. When an individual file is mounted into a container, Docker mounts the inode of the file on the Linux filesystem. If the file is replaced (which many editors do), the inode changes. Thus it can happen that writes to the file after starting the container won't be reflected between the inside and outside of the container.
For more detailed information, refer to this Docker issue: moby/moby#6011

To avoid such issues, it is often suggested mount the parent directory instead of relying on single file bind mounts.

volumes:
  - $PWD/etc:/etc/caddy

with the file tree

├── compose.yml
└── etc
    └── Caddyfile

It would make sense update the documentation accordingly or at least incorporate a warning about this docker issue with file mounts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant