How Do I Cache APT Packages In Bitbucket Pipelines? How Do I Cache APT Packages In Bitbucket Pipelines? docker docker

How Do I Cache APT Packages In Bitbucket Pipelines?


In Ubuntu-based docker images there is usually an apt hook that deletes the packages after installation. It is located in /etc/apt/apt.conf.d/.

In ubuntu:19.04, the file containing the hook is called docker-clean. If you remove that, you will be able to find all the packages that were downloaded in /var/cache/apt/archives.

As a consequence, just adding the following at the beginning of your pipeline should allow your apt cache to work as expected:

rm /etc/apt/apt.conf.d/docker-clean