-
Notifications
You must be signed in to change notification settings - Fork 75
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
Remove VOLUME
instructions
#118
Comments
Hi @jjlin, thanks for logging this issue.
This is a good point that I hadn't considered. I think I had conflated things when I made that comment originally 😉 Also, good point about a single volume - that would be simpler. However changing the values now would break existing users, and I'm not too excited about that. In many deployments only the data directory really needs to be persisted. As far as I understand, while it's useful to persist the config directory, it's less critical to TLS operations. I think how I'd like to proceed is to add some logic that prints a warning message if |
Adding the But as far as I can see, just removing the |
I think removing the volume instructions would really help many users in many use cases. If you just wan't to use caddy to serve static files or in a cluster scenario, you don't want to define multiple empty volumes. Here is a sample config file for the described caddy use case:
|
Hi @OCram85 - I'm open to reviewing a PR for this - see my comment in #118 (comment) - I still think a warning message of some sort may be useful. |
So maybe an additional image variant would help without breaking anything for the existing users / use cases. |
Is it documented anywhere that users should expect the image to implicitly persist
Dropping
Let me know if I misunderstood something 😅This can be ignored - Earlier response that was revised above.
This was a long-standing issue with The DockerHub Caddy instructions mention the Notes on
|
I'd rather not have an additional variant just to remove the instruction. Again, I'm open to this, and am willing to review a PR for this (see above)! |
So then I create PR which just removes the VOLUME instructions in the Dockerfiles. |
@OCram85 that's listed in the README. But let's focus on the PR itself first. |
Yup. Volumes are really superfluous. You have to declare them explicitly all the time to avoid getting "garbage" names in the volume list. And every derivative image (which inherits from caddy) will produce such volumes, you simply have no method to get rid of them. So, if I want to wrap my service into caddy and provide it to users, they have to do the same every time: declare volumes or get "garbage" names. So I still have to use nginx in such cases, but I would like to use one tool everywhere — caddy. |
@hairyhenderson I'm not sure what the PR status was in Feb, it seems to need some rebasing now (@OCram85 ?); but any chance of providing that review sometime? :) |
|
@polarathene: I can't speak for others, but my personal opinion to this is clear: |
Correct. My earlier comment covered that pretty well, even with only the terse version I thought.. but I'll try again.
I am of the opinion Original verbose/detailed attempt, before making terse version above
More reasons
|
Sorry for the radio silence on this one, folks. My goal is to get #220 merged real soon and released with the 2.5.0 image ~today-ish |
The current Dockerfiles specify
caddy-docker/2.1/alpine/Dockerfile
Lines 44 to 45 in edea053
The problem with this is it ends up creating anonymous volumes that aren't cleaned up when the Caddy container exits, even when the container is deleted. You can see this by running
docker run caddy true
followed bydocker volume ls
; repeat this a few times and note that new volumes keep building up.From #104 (comment), the stated rationale for having these
VOLUME
instructions is "to prevent [config and data] files from being written to the container, and hence lost during a container restart". However, even withoutVOLUME
, these files actually aren't lost during a container restart; they're just stored in the container's writable layer, which will exist as long as the container isn't actually deleted. Given that these anonymous volumes wouldn't be reused when creating a new Caddy container, this doesn't seem to have much advantage over just using the writable layer for storage.The docs already suggest creating named volumes
caddy_data
andcaddy_config
anyway, though this might be simpler as just a singlecaddy
volume mounted at/caddy
(or/srv/caddy
), withXDG_CONFIG_HOME=/caddy/config
andXDG_DATA_HOME=/caddy/data
.The text was updated successfully, but these errors were encountered: