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

Why is /var/cache/nginx a volume? #19

Closed
dpwspoon opened this issue Apr 14, 2015 · 7 comments
Closed

Why is /var/cache/nginx a volume? #19

dpwspoon opened this issue Apr 14, 2015 · 7 comments

Comments

@dpwspoon
Copy link

@dpwspoon dpwspoon commented Apr 14, 2015

I would like to know the reasoning on why /var/cache/nginx is a volume.

As an administrator of docker-nginx is this a folder I should archive by default?

@sherter
Copy link
Contributor

@sherter sherter commented Apr 14, 2015

I guess this is just for better performance. By declaring an explicit volume you bypass docker's copy-on-write backend (e.g. aufs) and bind-mount the data directly from the host filesystem.
Images like mysql do this for the same reason.

@thresheek
Copy link
Contributor

@thresheek thresheek commented Apr 14, 2015

It is there so you could re-use caches (if any) between nginx upgrades.

@dpwspoon
Copy link
Author

@dpwspoon dpwspoon commented Apr 14, 2015

I discovered this when I was trying to learn docker and I noticed I was unintentionally orphaning docker volumes.

It seems to me that there are several files you may want to keep between updates such as the conf directories. I've found this issue on why for nginx most of those are not included in the volume.

Other then the potential performance reasons mentioned by @sherter, I can't see why the cache would be a special case. As such perhaps it may be better to remove it for consistency, or have it documented on docker hub/_/nginx readme so people don't make the mistake of orphaning volumes.

@booyaa
Copy link

@booyaa booyaa commented Apr 16, 2015

isn't the cache used for static assets?

@Siilwyn
Copy link

@Siilwyn Siilwyn commented Aug 25, 2015

Other then the potential performance reasons mentioned by @sherter, I can't see why the cache would be a special case. As such perhaps it may be better to remove it for consistency, or have it documented on docker hub/_/nginx readme so people don't make the mistake of orphaning volumes.

I agree with this, at least document it in the readme.

dpwspoon pushed a commit to dpwspoon/docker-nginx that referenced this issue Aug 25, 2015
@dpwspoon
Copy link
Author

@dpwspoon dpwspoon commented Aug 25, 2015

updated the dockerfile with the reasoning provided by @sherter via pull request

@Siilwyn
Copy link

@Siilwyn Siilwyn commented Jan 11, 2016

👍 Nice!

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

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.