Why is it so?
config/log4j2.properties in the docker image only enables console logging. Docker makes container's console logs available via docker logs.
Even if a container fails to start you can get console logs to debug the issue as docker retains those for some time. If logs are stored only in a container directory (not mounted) you will lose these logs if the container fails to start or after it terminates.