Why do I need ENV container docker?

Hello, other than suppress the systemd output on the console logs, why do I need to have the following statement in my Docker.template file?

ENV container docker

Does it actually serve a functional purpose pass log output?

Hi @kml001 I think that ENV is needed to allow systemd to start up correctly in a container. I think if you removed it, systemd would not behave correctly.

Thanks for the suggestion, however, I have not observed any ill effects and it seems to function OK without it. Can we find any more detail?

It might not have very large impact. I found the following:

To allow systemd (and other code) to identify that it is executed within a container, please set the $container= environment variable for PID 1 in the container to a short lowercase string identifying your implementation. With this in place the ConditionVirtualization= setting in unit files will work properly. Example: “container=lxc-libvirt”

From ContainerInterface