ド級のリトライ
ドリトライだ!
I missed to bookmark it, but I read an article about reducing Docker image size.
I browsed some web pages, but couldn't find definitive resources on that. Here are my understanding summarizing the information on the internet.
Short version: “simple tags” will usually be a single platform (Windows vs Linux) and “shared tags” will be a combination of multiple platforms[1].
When using simple tags such as alpine, the specific Linux distribution or Windows OS is used.
When using shared tags such as tags without suffix, Docker checks the architecture and OS of our local machine and determines which one of listed OS to use.
For example, Python's
Docker shared tag 3.12
consists of these
In my case, Debian-based 3.12.3-bookworm (DebianBookworm) will be used because I use MacBook.
bookworm
refers to Debian Linux's Bookworm variant,
which contains up-to-date packages and softwares installed.
Shared tags often (at least for my MacOS workstation) refers to
bookworm
.
alpine
refers to Alpine Linux, which is a super
lightweight Linux distribution. It is the smallest Docker image option,
but lacks tools or libraries.
slim
is a down-sized version of bookworm
,
(generated with [SlimToolkit] ?) to
optimize contianer image size.
Keeping Docker container images as small as possible is a good way to reduce the required space in servers. Also, it can make CI (Continuous Integration, such as testing or auto-deployment) complete in shorter time.
bookworm
is the simplest option but contains many
redundant libraries.
alpine
is the smallest option, but I see people don't
recommend to use it because configuring it is very hard; required
packages/libraries need to be installed manually. It seems people keep
running into issues managing alpine
container image
properly.
slim
is generally recommended because it has smaller
container image size than bookworm
, but also includes basic
libraries, making it wasy to configure and manage.
For our Django (Python) project, replacing a shared tag with slim one reduced the container image size by about 40%.
Sushi bowl 900 Yogurt 300 Bubble tea 600
Total 1800 kcal
TODO: