LXD lighter image


(Emerson Barea) #1

Hi there.

Please, what is the lighter AMD-64 image available at Linux Containers - Image server (https://us.images.linuxcontainers.org) ?

lighter = fewer processes, memory and disk usage per container.

Thanks.

Emerson Barea


#2

You can get the list of images along with their size by running

$ lxc image list images:
+-------------------------------+--------------+--------+------------------------------------------+---------+----------+-------------------------------+
|             ALIAS             | FINGERPRINT  | PUBLIC |               DESCRIPTION                |  ARCH   |   SIZE   |          UPLOAD DATE          |
+-------------------------------+--------------+--------+------------------------------------------+---------+----------+-------------------------------+
| alpine/3.4 (3 more)           | cc8b58012122 | yes    | Alpine 3.4 amd64 (20180627_17:50)        | x86_64  | 2.04MB   | Jun 27, 2018 at 12:00am (UTC) |
+-------------------------------+--------------+--------+------------------------------------------+---------+----------+-------------------------------+
| alpine/3.4/armhf (1 more)     | 7813a1299900 | yes    | Alpine 3.4 armhf (20180627_17:50)        | armv7l  | 1.63MB   | Jun 27, 2018 at 12:00am (UTC) |
+-------------------------------+--------------+--------+------------------------------------------+---------+----------+-------------------------------+
| alpine/3.4/i386 (1 more)      | 612c3ece0803 | yes    | Alpine 3.4 i386 (20180627_17:50)         | i686    | 1.88MB   | Jun 27, 2018 at 12:00am (UTC) |
+-------------------------------+--------------+--------+------------------------------------------+---------+----------+-------------------------------+
...

The smallest the container image size, the smaller the container and the less resources it would use.
There are already hints that the Alpine Linux container images should be the lightest of all.
But how can we sort the list of container images per size?

Run the following:

$ lxc image list images: --format=csv > ContainerImages.csv

Then, you can open the CSV file with LibreOffice or MSOffice and sort the table by container size.
The output will look like:

Container image Hash Public Description Architecture Size Upload Date
alpine/3.4/armhf (1 more) 7813a1299900 yes Alpine 3.4 armhf (20180627_17:50) armv7l 1.63MB Jun 27, 2018 at 12:00am (UTC)
27aba5e24506 yes Alpine 3.4 armhf (20180626_17:50) armv7l 1.63MB Jun 26, 2018 at 12:00am (UTC)
7e3a420c6c75 yes Alpine 3.4 armhf (20180625_17:50) armv7l 1.63MB Jun 25, 2018 at 12:00am (UTC)
alpine/3.4/i386 (1 more) 612c3ece0803 yes Alpine 3.4 i386 (20180627_17:50) i686 1.88MB Jun 27, 2018 at 12:00am (UTC)
4f2eff83cffc yes Alpine 3.4 i386 (20180625_17:50) i686 1.88MB Jun 25, 2018 at 12:00am (UTC)
8986e64111be yes Alpine 3.4 i386 (20180626_17:50) i686 1.88MB Jun 26, 2018 at 12:00am (UTC)
alpine/3.4 (3 more) cc8b58012122 yes Alpine 3.4 amd64 (20180627_17:50) x86_64 2.04MB Jun 27, 2018 at 12:00am (UTC)
5e9aad1cf27b yes Alpine 3.4 amd64 (20180626_17:50) x86_64 2.04MB Jun 26, 2018 at 12:00am (UTC)
b97b6900ecfd yes Alpine 3.4 amd64 (20180625_17:50) x86_64 2.04MB Jun 25, 2018 at 12:00am (UTC)
alpine/3.8/arm64 (1 more) c5d37d9ac0e3 yes Alpine 3.8 arm64 (20181126_13:02) aarch64 2.23MB Nov 26, 2018 at 12:00am (UTC)
47f6ed377372 yes Alpine 3.8 arm64 (20181125_01:46) aarch64 2.23MB Nov 25, 2018 at 12:00am (UTC)
627fde699ff6 yes Alpine 3.8 arm64 (20181125_13:02) aarch64 2.23MB Nov 25, 2018 at 12:00am (UTC)

Therefore, the Alpine 3.4 container image is the smallest of all.
It is also possible to check the number of running processes between each container and get a more precise answer. However, I strongly believe that Alpine is the lightest of all.

There is the possibility to create an even leaner container image, presumably working on the Alpine Linux container image. For that, see distrobuilder at https://github.com/lxc/distrobuilder
See https://blog.simos.info/how-to-create-a-minimal-container-image-for-lxc-lxd-with-distrobuilder/ for a hint on how to do that.


(Emerson Barea) #3

Great Simos. This is exactly that I need.

Thank you.

Emerson Barea


(Emerson Barea) #4

Another way is import busybox image like procedure found in " Importing from a URL" topic at https://stgraber.org/2016/03/30/lxd-2-0-image-management-512/

using this command: lxc image import https://dl.stgraber.org/lxd --alias busybox-amd64