3 comments

[ 3.4 ms ] story [ 18.1 ms ] thread
Adding these commands to a separate script seems like an unnecessary level of abstraction.

Concatenating the commands with &&, adding "--no-install-recommends", and adding " && apt-get clean && rm -rf /var/lib/apt/lists/*" to the Dockerfile seems much more straightforward and maintainable.

you shouldn't be installing syslog-ng in your container. Containers should do a single thing. If you want syslog, run a syslog-ng container.
The initial container is a contrived worst case example. Not necessarily a bad idea when you want to make a point but most of the gains are from not doing things you’re told not to do on page 2 of the docker tutorial.

Also, while vanilla Dockerfiles do need to carefully clean up after themselves BuildKit offers you a friendlier way of handling this with ‘--mount=type=cache’ on the appropriate directories