mount=type=cache more in-depth explanation?
Hi, I'm trying to use cache mounts to speed up things like `apt install`, `pip install` or `ccache` when rebuilding my containers. For each of these, I prefix each RUN command using apt/pip/ccache... with things like: RUN --mount=type=cache,target=/var/cache/apt,rw --mount=type=cache,target=/var/lib/apt,rw \ That seems to work sometimes, but I found out I can't understand the cache invalidation rules. The cache just from time to time disappears and I have to download all the cached packages again. I made explicit effort to remove all `apt clean` commands from the dockerfile, so the cache is not deleted programatically. And it also happens to CCache, which is not autodeleted. Could somebody please explain how does it work and when exactly can the cache be reused, when (if at all) is it discarded, where is it saved...? What is the exact effect of the `id` parameter? I also found out that if I want to create a cache directory for a non-root user, I can create it with cache mount option `uid=1000`. But if I use `uid=1000,gid=1000`, the folder gets ownership `root:root`, which is really weird. Can it be connected with me not using `id` and setting some caches with `uid=0` and some with `uid=1000`? Does this create some kind of conflict? And is there actually a good reason for setting the `mode` to anything else than `777`? If it's only used during build, I don't get why anybody would care about permissions... Thank you for helping. Maybe some of the answers could be a
Posted by peci1 on Sep 5, 2020, 1:38 PM
Tags
Related issues
- I just invented a simple upgrade script for my father's ancient Fedora install.
- Weekly limit is draining like the old 5-hour limit
- Rather people unable to setup a static websites where needed.
- Besides the general awfulness of Windows that you describe, have you looked at C:\Windows recently?
- Does your work involves using teams or ms office or docker?
- Meta: Sorry, no response was returned
Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments
onboarding (Other)
I just invented a simple upgrade script for my father's ancient Fedora install.
Weekly limit is draining like the old 5-hour limit
Rather people unable to setup a static websites where needed.
Besides the general awfulness of Windows that you describe, have you looked at C:\Windows recently?
Does your work involves using teams or ms office or docker?
Meta: Sorry, no response was returned
Recent FrankerFaceZ Issues with Firefox
Allow creating a `python` shim on `python install`
mount=type=cache more in-depth explanation?
Hi, I'm trying to use cache mounts to speed up things like `apt install`, `pip install` or `ccache` when rebuilding my containers. For each of these, I prefix each RUN command using apt/pip/ccache... with things like: RUN --mount=type=cache,target=/var/cache/apt,rw --mount=type=cache,target=/var/lib/apt,rw \ That seems to work sometimes, but I found out I can't understand the cache invalidation rules. The cache just from time to time disappears and I have to download all the cached packages again. I made explicit effort to remove all `apt clean` commands from the dockerfile, so the cache is not deleted programatically. And it also happens to CCache, which is not autodeleted. Could somebody please explain how does it work and when exactly can the cache be reused, when (if at all) is it discarded, where is it saved...? What is the exact effect of the `id` parameter? I also found out that if I want to create a cache directory for a non-root user, I can create it with cache mount option `uid=1000`. But if I use `uid=1000,gid=1000`, the folder gets ownership `root:root`, which is really weird. Can it be connected with me not using `id` and setting some caches with `uid=0` and some with `uid=1000`? Does this create some kind of conflict? And is there actually a good reason for setting the `mode` to anything else than `777`? If it's only used during build, I don't get why anybody would care about permissions... Thank you for helping. Maybe some of the answers could be a
Comments (0)
No comments yet. Start the discussion.