Using Docker to find out what apt get update does!

Using Docker to find out what apt get update does!


While I dabble in System Administration, I dont have a deep knowledge how packages are created or maintained. Today, well see how to use Docker to increase my understanding of "apt-get update". I was curious about this command because I read that its good practice to remove the files created during the update process.

I started a small container using

docker run -i -t debian:wheezy /bin/bash 

In another window, I found the ID of the running container using "docker ps". Lets pretend that ID starts with "45...". Look for any changed files using

docker diff "45" 

Youll see nothing displayed. Now run "apt-get update" in the wheezy container. Then run the diff command again. You should see the following differences:

C /var C /var/lib C /var/lib/apt C /var/lib/apt/lists A /var/lib/apt/lists/http.debian.net_debian_dists_wheezy-updates_Release A /var/lib/apt/lists/http.debian.net_debian_dists_wheezy-updates_Release.gpg A /var/lib/apt/lists/http.debian.net_debian_dists_wheezy-updates_main_binary-amd64_Packages.gz A /var/lib/apt/lists/http.debian.net_debian_dists_wheezy_Release A /var/lib/apt/lists/http.debian.net_debian_dists_wheezy_Release.gpg A /var/lib/apt/lists/http.debian.net_debian_dists_wheezy_main_binary-amd64_Packages.gz A /var/lib/apt/lists/lock C /var/lib/apt/lists/partial A /var/lib/apt/lists/security.debian.org_dists_wheezy_updates_Release A /var/lib/apt/lists/security.debian.org_dists_wheezy_updates_Release.gpg A /var/lib/apt/lists/security.debian.org_dists_wheezy_updates_main_binary-amd64_Packages.gz 

Inside the wheezy container we now know where to look to find file sizes:

# ls -lh /var/lib/apt/lists total 8.0M -rw-r--r-- 1 root root 121K Nov 23 02:49 http.debian.net_debian_dists_wheezy-updates_Release -rw-r--r-- 1 root root 836 Nov 23 02:49 http.debian.net_debian_dists_wheezy-updates_Release.gpg -rw-r--r-- 1 root root 0 Nov 23 02:37 http.debian.net_debian_dists_wheezy-updates_main_binary-amd64_Packages -rw-r--r-- 1 root root 165K Oct 18 10:33 http.debian.net_debian_dists_wheezy_Release -rw-r--r-- 1 root root 1.7K Oct 18 10:44 http.debian.net_debian_dists_wheezy_Release.gpg -rw-r--r-- 1 root root 7.3M Oct 18 10:07 http.debian.net_debian_dists_wheezy_main_binary-amd64_Packages.gz -rw-r----- 1 root root 0 Nov 23 04:09 lock drwxr-xr-x 2 root root 4.0K Nov 23 04:09 partial -rw-r--r-- 1 root root 100K Nov 20 16:31 security.debian.org_dists_wheezy_updates_Release -rw-r--r-- 1 root root 836 Nov 20 16:31 security.debian.org_dists_wheezy_updates_Release.gpg -rw-r--r-- 1 root root 270K Nov 20 16:31 security.debian.org_dists_wheezy_updates_main_binary-amd64_Packages.gz 

Obviously, those .gz files might be interesting. Its easy enough to uncompress them:

gzip -d http.debian.net_debian_dists_wheezy_main_binary-amd64_Packages.gz 

And now its possible to see whats inside:

# more http.debian.net_debian_dists_wheezy_main_binary-amd64_Packages Package: 0ad Version: 0~r11863-2 Installed-Size: 8260 Maintainer: Debian Games Team  Architecture: amd64 Depends: 0ad-data (>= 0~r11863), 0ad-data (<= 0~r11863-2), gamin | fam, libboost-signals1.49.0 (>= 1.49.0-1), libc6 (>= 2.11), libcurl3-gnutls (>= 7.16.2), libenet1a, libgamin0 | libfam0, libgcc1 (>= 1:4.1.1), libgl1-mesa-glx | libgl1, lib jpeg8 (>= 8c), libmozjs185-1.0 (>= 1.8.5-1.0.0+dfsg), libnvtt2, libopenal1, libpng12-0 (>= 1.2.13-4), libsdl1.2debian (>= 1.2.11), libstdc++6 (>= 4.6), libvorbisfile3 (>= 1.1.2), libwxbase2.8-0 (>= 2.8.12.1), libwxgtk2.8-0 (>= 2.8.12.1), l ibx11-6, libxcursor1 (>> 1.1.2), libxml2 (>= 2.7.4), zlib1g (>= 1:1.2.0) Pre-Depends: dpkg (>= 1.15.6~) Description: Real-time strategy game of ancient warfare Homepage: http://www.wildfiregames.com/0ad/ Description-md5: d943033bedada21853d2ae54a2578a7b Tag: game::strategy, implemented-in::c++, interface::x11, role::program, uitoolkit::sdl, uitoolkit::wxwidgets, use::gameplaying, x11::application Section: games Priority: optional Filename: pool/main/0/0ad/0ad_0~r11863-2_amd64.deb Size: 2260694 MD5sum: cf71a0098c502ec1933dea41610a79eb SHA1: aa4a1fdc36498f230b9e38ae0116b23be4f6249e SHA256: e28066103ecc6996e7a0285646cd2eff59288077d7cc0d22ca3489d28d215c0a ... 

Given the information about the text file, we can find out how many packages are available:

# grep "Package" http.debian.net_debian_dists_wheezy_main_binary-amd64_Packages | wc -l 36237 

Now you know why its important to run the following in your Dockerfile after using apt-get to install software.

rm -rf /var/lib/apt/lists/* 

Have fun exploring!

download file now

Popular posts from this blog

UTAUloid Voicebank Download Utane Uta Defoko

Video Mesum Ariel Dengan Wulan Guritno