Tuesday, December 21, 2021

Installing apt-get and bash into the .Net 6 Alpine container

The minimal container image of .Net 6 comes really lightweight. The name of the image at least we are using is dotnet/runtime:6.0.1-alpine3.14. It has very little footprint below 40-50 MB during runtime. But that doesn't even have a ping utility, bash shell, sudo command, and not even the apt-get to install other packages. This minimal behavior makes it difficult to debug.

Below goes the steps to install apt-get into that container to troubleshoot applications especially when deployed in Kubernetes.

apk update

apk upgrade

apk add apt-get

Once the apt-get is there we can install anything including bash. All the above commands can be executed using the regular command execution technique in Kubernetes as follows

kubectl exec <pod> -- <command>

Happy Kuberneting...

No comments: