EddieM
EddieM

Reputation: 111

See instance journalctl logs in docker container

I want to be able run a Docker container and see all instance journalctl logs.

In other words I want to see the same output of journalctl logs in the instance and in the Docker container.

I was trying to mount the journald socket but still I don't see the journal logs from the instance.

Upvotes: 2

Views: 7252

Answers (1)

Eric Zaluzec
Eric Zaluzec

Reputation: 41

If journalctl -u <service>.service are not giving you the journal logs you want from your container, you can run machinectl -l to find the container's UUID and then run a journalctl -M $UUID on the container uuid to see logs.

~# machinectl -l
MACHINE                                  CLASS     SERVICE OS VERSION ADDRESSES
rkt-6d427a1c-6961-45a2-a055-721edddb8558 container rkt     -  -       -



~# journalctl -M rkt-6d427a1c-6961-45a2-a055-721edddb8558

If your systemd service starting your docker container is not listed under machinectl list, then add the following to your systemd service file that is starting your container:

[Service]
Slice=machine.slice

Upvotes: 2

Related Questions