On WSL2 with systemd enabled, getting journald is not enabled on this host

I have several containers and I am basically trying to get logs when my containers are running. Since debian bookworm is using systemd now, the logs are not available in ‘/var/log’. So, I am trying to use the following command in WSL2 debian so that the containers log through systemd:
‘# docker run --log-driver=journald -d --name test some_image’

[Issue type] I have enabled systemd on WSL2 and it shows as running but docker complains that:
docker: Error response from daemon: failed to create task for container: failed to initialize logging driver: journald is not enabled on this host.

[OS Version/build]
Host is Windows 10
WSL2 is running Debian Bookworm
‘# cat /etc/debian_version’
12.2

cmd> wsl --version
WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Windows version: 10.0.19045.3570

[App version]
Docker desktop version 4.24.2 (124339)

[Steps to reproduce] (on the WSL2 Debian Bookworm logged in as root):
‘# systemctl status systemd-journald’
● systemd-journald.service - Journal Service
Loaded: loaded (/lib/systemd/system/systemd-journald.service; static)
Active: active (running) since Thu 2023-11-02 17:00:22 EDT; 4 days ago

‘# docker run --log-driver=journald -d --name test some_image’
docker: Error response from daemon: failed to create task for container: failed to initialize logging driver: journald is not enabled on this host.

If it is Docker Desktop as the category indicates, the daemon is running its own WSL2 distribution, which is a container itself on WSL2’s virtual machine, and inside that Docker Desktop runs containerd containers and in one of those runs the Dcoker daemon. Even if you enable systemd in a WSL distribution, you can’t change how Docker Desktop works.

Thanks for the clarification. So, if I understood correctly, I cannot use this docker log feature on Windows. I think it shows as available when I do ‘docker system info’ so I thought I could use it.

But I am wondering if the apps (apache, postfix, …) running in the linux containers will be able to log using journald in the linux VM (WSL)?

If not, how can I get any log from the apps (apache, postfix, …) using Debian bookworm if I want to stick with the Debian team’s decision of using systemd for logging.

That was probably just the list of plugins, it doesn’t mean you have an endpoint fo those.

Usually apps in containers should log to the standard output and standard error stream of the container which can be handled by logging drivers as you tried. If one driver can’t be used, you can choose another. You can for example log to a remote syslog server which can run in a WSL2 distribution if you can make sure that distribution is running when you start the containers.

I’M not sure what you mean. Applications running without containers can have and usually have different strategy for logging. Just because Apache HTTPD without containers log to journald (I haven’t run Apache HTTPD without containers for a long time so I don’t know), it doesn’t mean you need to do the same in containers. Just don’t install Apache HTTP from the debian APT repository. Use the official Docker base image and run it in one container and postfix in another (or postfix alternatives if that is easier).

Thanks a lot for your help. It will save me a lot of time.