brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: journalctl -M reads the journal of a running local container

Journalctl
~/tips/tip-journalctl-machine-container-logs

journalctl -M mycontainer -b

Reads the journal of a running systemd container from the host by its machine name.

A systemd container keeps its own journal, and I can read it from the host without logging in.

-M or --machine= connects to a running local container by name and shows its messages. It is meant for containers that systemd knows as machines, such as those started with systemd-nspawn, and machinectl list prints the names.

journalctl -M mycontainer -b

It is not the tool for Docker containers. Those write to their own logging driver, and docker logs is the way to read them.

Further reading: journalctl(1) manual page

More Journalctl tips journalctl -k -g 'killed process' --since "2 days ago" journalctl _PID=1 -b ls -lh /var/log/journal/*/*.journal~ Storage=volatile sudo journalctl --setup-keys All Journalctl tips (81) All topics

Link