-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Config apt inside docker images to save disk space: auto clean, gz, n…
…o trans (#69)
- Loading branch information
1 parent
0f0f992
commit af38c0e
Showing
5 changed files
with
230 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 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/docker/docker/issues). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Since Docker users using "RUN apt-get update && apt-get install -y ..." in | ||
# their Dockerfiles don't go delete the lists files afterwards, we want them to | ||
# be as small as possible on-disk, so we explicitly request "gz" versions and | ||
# tell Apt to keep them gzipped on-disk. | ||
|
||
# For comparison, an "apt-get update" layer without this on a pristine | ||
# "debian:wheezy" base image was "29.88 MB", where with this it was only | ||
# "8.273 MB". | ||
|
||
Acquire::GzipIndexes "true"; | ||
Acquire::CompressionTypes::Order:: "gz"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# In Docker, we don't often need the "Translations" files, so we're just wasting | ||
# time and space by downloading them, and this inhibits that. For users that do | ||
# need them, it's a simple matter to delete this file and "apt-get update". :) | ||
|
||
Acquire::Languages "none"; |