Lone Learner
Lone Learner

Reputation: 20688

How to investigate the differences between two Docker images of Ubuntu?

The docker image of Ubuntu 14.04 is larger in size and has the lsb_release command.

$ docker run -it ubuntu:14.04
root@c0384d45aba3:/# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty
root@c0384d45aba3:/# exit
exit
$ docker images ubuntu:14.04
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              14.04               7c09e61e9035        6 weeks ago         188 MB

The docker image of Ubuntu 16.04 is smaller in size and does not have the lsb_release command.

$ docker run -it ubuntu:16.04
root@853f2dd91c36:/# lsb_release -a
bash: lsb_release: command not found
root@853f2dd91c36:/# exit
exit
$ docker images ubuntu:16.04
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              16.04               0ef2e08ed3fa        6 weeks ago         130 MB

Starting with their Dockerfiles, how can I get to the bottom of what causes this difference?

Upvotes: 0

Views: 317

Answers (1)

Lone Learner
Lone Learner

Reputation: 20688

Here are the Dockerfiles for both images.

Here is the only difference between these two files.

-ADD ubuntu-trusty-core-cloudimg-amd64-root.tar.gz /
+ADD ubuntu-xenial-core-cloudimg-amd64-root.tar.gz /

So now we download both the .tar.gz files from

Indeed lsb_release is contained in trusty but not in xenial.

$ tar -tf ubuntu-trusty-core-cloudimg-amd64-root.tar.gz | grep lsb_release$
usr/bin/lsb_release
$ tar -tf ubuntu-xenial-core-cloudimg-amd64-root.tar.gz | grep lsb_release$
$

Then we extract the contents of both tarballs to directories and we can confirm that trusty is larger than xenial.

$ mkdir trusty xenial
$ tar -xf ubuntu-trusty-core-cloudimg-amd64-root.tar.gz -C trusty
$ tar -xf ubuntu-xenial-core-cloudimg-amd64-root.tar.gz -C xenial
$ du -sh trusty xenial
208M    trusty
141M    xenial

Upvotes: 3

Related Questions