0
ning

research apt cache for docker build

Recommended Posts

the main proposal of this research is to enable cached apt archives for docker build.

 

first apt cache can be saved by a docker volume, but due to `${SDCARD}/var/cache/apt/archives` is not a constant, then we can't use `-v=apt-cache:${SDCARD}/var/cache/apt/archives` to enable it.

 

so I use `-v=apt-cache:/root/.apt` as a tmp place for apt cache, when need `apt install` in `${SDCARD}`, use `mount -o bind /root/.apt ${SDCARD}/var/cache/apt/archives` and after install finishes, `umount ${SDCARD}/var/cache/apt/archives`

 

this looks perfect, but after I check /root/.apt, everything is gone.

 

I double checked whether *.deb are saved to /root/.apt, I can find them before `umount`, or even use apt-cache in another container: `docker run --privileged --rm -v=apt-cache:/test -it ubuntu:18.04 bash` I can find debs in /test folder, and gone after `umount`

 

I really don't know why.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0