Docker: How to install packages to busybox image?
Busybox image is very useful to execute a simple binary on Docker because the image size is quite small. However there's no commands like apt-get or yum to install additional packages. So, if it's necessary to do that, using Alpine Linux image is the best choice instead of Busybox image . Let me share why is it and what we should do when it's necessary.
First, what's "busybox" exactly? According to the official site , it said "BusyBox combines tiny versions of many common UNIX utilities into a single small executable." And also they said it's "The Swiss Army Knife of Embedded Linux." It means that it's a "tool" not a "distribution." On the other hand, Alpine Linux's official site said "Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox ." And also, as you know, Alpine Linux has the package management command "apk." So, it means the following.
1Alpine Linux = BusyBox + musl libc + apk
So, don't try to install some packages to Busybox image . When you want to install something as a package, you should use Alpine Linux image instead of Busybox image . Of course, you can also use other images like Ubuntu, Debian, CentOS and so on but you should accept that its image size is going to be bigger than Alpine Linux image .