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

Original 📋 Debian 9 (Stretch) 19 lines

Works On

Viewing:
Debian 9 (Stretch)
Same on:
Debian 10 (Buster) Debian 11 (Bullseye) Debian 12 (Bookworm) Debian 13 (Trixie)
Other versions:

Details

Size
19 lines
MD5
aafe213f11482d9cdc6b0c19a86c93ac
SHA256
484f60f8d215bf22008b5fe7dd8484350d7abd44655ea79accee79ce11976c81
/etc/apt/apt.conf.d/docker-clean
# 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).

Copy & Paste

curl:
curl https://exampleconfig.com/api/v1/config/original/aafe213f11482d9cdc6b0c19a86c93ac?hint=docker-clean
wget:
wget -O docker-clean https://exampleconfig.com/api/v1/config/original/aafe213f11482d9cdc6b0c19a86c93ac?hint=docker-clean

For AI Agents

<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.

Install APT

Debian

sudo apt update && sudo apt install apt

Ubuntu

sudo apt update && sudo apt install apt

File Location

File Path
/etc/apt/apt.conf.d/docker-clean
Directory
/etc/apt/apt.conf.d/
Significance
System-wide configuration directory
Description
Files in /etc/ contain system-wide configuration settings that affect all users.

FAQ

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.