In
you want to install network tools (like ping) you need to install
You can squash your image size even further by some tips. When you install a package, linux distros first download the package and put it in a cache folder. In
To tell the OS to delete the cache after installation you can provide
There are some package like
y using
Great job guys! You have reduced your alpine docker images so much :)
#docker #linux #alpine #apk #virtual #no_cache #apk_del #apk_add
Dockerfile`s some people in the community use `alpine
base image in order to reduce docker image size. apk
is its package management tool that can be used to install OS packages. So for example ifyou want to install network tools (like ping) you need to install
netcat-openbsd
:apk add netcat-openbsd
You can squash your image size even further by some tips. When you install a package, linux distros first download the package and put it in a cache folder. In
Alpine
it is located in /var/cache/apk
.To tell the OS to delete the cache after installation you can provide
--no-cache
option to it:apk add --no-cache netcat-openbsd
There are some package like
g++
or git
that is needed on installation of some other packages. After installation those packages is useless and just increase image size. You can remove those packages by using
--virtual
command:apk add --no-cache --virtual .build-deps g++ \
&& # do you stuff here \
&& apk del .build-deps
Great job guys! You have reduced your alpine docker images so much :)
#docker #linux #alpine #apk #virtual #no_cache #apk_del #apk_add