Learn extra at:
Use a ‘slim’ runtime picture
For a lot of purposes written in languages that require a runtime, you should utilize a “slim” runtime picture for the language. These are prebuilt photos that include the naked minimal of what’s wanted to launch and run an software written within the given language.
It’s value saying once more that slim photos solely provide you with what’s wanted to help the runtime itself, not your specific software. As an example, if in case you have a Python software that wants third-party packages from PyPI, you should add these as a part of the picture construct course of (RUN pip set up
, and so forth.).
One other good supply for slender base photos, constructed for particular use circumstances, is the Google Distroless Image assortment. They’re constructed on high of stripped-down situations of Debian Linux, run on a number of architectures, and provide included runtimes for Python 3, C-compiled packages, Java (together with variations 17 and 21), and Node.js (variations 18, 20, and 22). They don’t include shells or bundle managers, so you should configure your Dockerfile’s ENTRYPOINT
so it received’t try to make use of a shell (e.g., ENTRYPOINT ["start"]
as a substitute of ENTRYPOINT "begin"
) or provide arguments to the language runtime configured because the default.