Giter Club home page Giter Club logo

Comments (5)

wch avatar wch commented on July 21, 2024 31

It does automatically do a clean after each package install, which you can see with this command:

$ docker run --rm debian cat /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/docker/docker/issues).

Edit: there are a couple other files in that directory that may be relevant (languages, etc).

from rocker.

eddelbuettel avatar eddelbuettel commented on July 21, 2024

At some point I started to have the suspicion that Docker does that -- as I never see deb files in /var/cache/apt/archives. But maybe I tricked myself ...

from rocker.

cboettig avatar cboettig commented on July 21, 2024

Yeah, I'm confused because on debian:testing if I try apt-get install ed without running apt-get update it just says package not found, but on r-base it runs without an update:

 docker run --rm -it rocker/r-base bash
root@8c2f850457d6:/# apt-get install ed
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ed is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

Seems like it has found some package lists to read? But then running apt-get clean doesn't change this behavior, so I'm confused about what package list it's reading...

from rocker.

eddelbuettel avatar eddelbuettel commented on July 21, 2024

@cboettig I fear you are getting confused between package downloads and metadata about packages.

@wch Thanks, I suspected something like that. Nice find.

from rocker.

cboettig avatar cboettig commented on July 21, 2024

Thanks both!

from rocker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.