When should I use this docker-clean?
Use it to restore a missing default, confirm what shipped, or diff against your current APT config.
# Since for most Docker users, package installs happen in "docker build" steps,
# they essentially become individual layers due to the way Docker handles
# layering, especially using CoW filesystems. What this means for us is that
# the caches that APT keeps end up just wasting space in those layers, making
# our layers unnecessarily large (especially since we'll normally never use
# these caches again and will instead just "docker build" again and make a brand
# new image).
# Ideally, these would just be invoking "apt-get clean", but in our testing,
# that ended up being cyclic and we got stuck on APT's lock, so we get this fun
# creation that's essentially just "apt-get clean".
DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };
APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };
Dir::Cache::pkgcache "";
Dir::Cache::srcpkgcache "";
# Note that we do realize this isn't the ideal way to do this, and are always
# open to better suggestions (https://github.com/debuerreotype/debuerreotype/issues).
curl https://exampleconfig.com/api/v1/config/original/aafe213f11482d9cdc6b0c19a86c93ac?hint=docker-clean
wget -O docker-clean https://exampleconfig.com/api/v1/config/original/aafe213f11482d9cdc6b0c19a86c93ac?hint=docker-clean
<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/aafe213f11482d9cdc6b0c19a86c93ac?hint=docker-clean' /><config><app>APT</app><os>Debian 9 (Stretch)</os><location>/etc/apt/apt.conf.d/docker-clean</location><lines>19</lines><md5>aafe213f11482d9cdc6b0c19a86c93ac</md5><sha256>484f60f8d215bf22008b5fe7dd8484350d7abd44655ea79accee79ce11976c81</sha256></config></prompt>
Paste into Claude, ChatGPT, or any AI assistant.
sudo apt update && sudo apt install apt
sudo apt update && sudo apt install apt
When should I use this docker-clean?
Use it to restore a missing default, confirm what shipped, or diff against your current APT config.
How do I restore APT defaults?
Download the file, back up the current one in /etc/apt/apt.conf.d/docker-clean, replace it, then reload or restart APT.
Is docker-clean safe for production?
It is the vendor default for Debian 9 (Stretch). Treat it as a baseline and review security and performance settings before production use.
How does this differ from other OS versions?
Defaults vary by distro and version. This copy matches Debian 9 (Stretch).
Can I use this for APT troubleshooting?
Yes. Diff it against yours to find drift, then restore only the sections you need.