Podman logs container output in duplicate with journald
I'm experimenting with Podman on a Ubuntu 22.04 Vagrant box. I installed Podman and its dependencies manually from GitHub releases rather than using the outdated version in the Ubuntu repositories. This means I had to rely on web sources for my configuration files, and I may have gotten something a bit wrong. Here's the systemd service file: [Unit] Description=TileServer GL After=network-online.target Requires=network-online.target [Service] Restart=always ExecStartPre=/usr/bin/podman pull maptiler/tileserver-gl:v3.1.1 ExecStart=/usr/bin/podman container run --rm \ --name tileserver -u www-data -p 8083:8080 \ -v /vagrant_data/resources/tiles:/data \ maptiler/tileserver-gl:v3.1.1 \ -c /etc/tileserver.json \ --public_url https://devserver.local/tiles [Install] WantedBy=default.target /etc/containers/containers.conf: [containers] log_driver="journald" tz="local" [network] network_backend="netavark" registries.conf and policy.json are minimal and have nothing related to this issue. When I run the service and do `journalctl -u tileserver`, this is what gets logged after the container has been pulled and started: Aug 17 14:53:51 mapapi-dev tileserver[11742]: Starting tileserver-gl v3.1.1 Aug 17 14:53:51 mapapi-dev podman[11671]: Starting tileserver-gl v3.1.1 Aug 17 14:53:51 mapapi-dev tileserver[11742]: No MBTiles specified, using zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev podman[11671]: No MBTiles specified, using zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev tileserver[11742]: [INFO] Automatically creating config file for zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev tileserver[11742]: [INFO] Only a basic preview style will be used. Aug 17 14:53:51 mapapi-dev podman[11671]: [INFO] Automatically creating config file for zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev podman[11671]: [INFO] Only a basic preview style will be used. Aug 17 14:53:51 mapapi-dev podman[11671]: [INFO] See documentation to learn how to create config.json file. Aug 17 14:53:51 mapapi-dev tileserver[11742]: [INFO] See documentation to learn how to create config.json file. Aug 17 14:53:51 mapapi-dev tileserver[11742]: Run with --verbose to see the config file here. Aug 17 14:53:51 mapapi-dev podman[11671]: Run with --verbose to see the config file here. Aug 17 14:53:51 mapapi-dev tileserver[11742]: Starting server Aug 17 14:53:51 mapapi-dev podman[11671]: Starting server Aug 17 14:53:51 mapapi-dev tileserver[11742]: Listening at http://[::]:8080/ Aug 17 14:53:51 mapapi-dev podman[11671]: Listening at http://[::]:8080/ Aug 17 14:53:51 mapapi-dev tileserver[11742]: Startup complete Aug 17 14:53:51 mapapi-dev podman[11671]: Startup complete So, everything that tileserver prints to stdout, podman repeats. If I run the container as a simple terminal command outside systemd, everything is only printed out once. Any ideas for a fix? I don't particularly care whether it's the 'tileserver' or 'podman' rows out of the duplicated ones that end up in the logs, but I'd rather not have both logged.
I'm experimenting with Podman on a Ubuntu 22.04 Vagrant box. I installed Podman and its dependencies manually from GitHub releases rather than using the outdated version in the Ubuntu repositories. This means I had to rely on web sources for my configuration files, and I may have gotten something a bit wrong.
Here's the systemd service file:
[Unit] Description=TileServer GL After=network-online.target Requires=network-online.target
[Service] Restart=always ExecStartPre=/usr/bin/podman pull maptiler/tileserver-gl:v3.1.1 ExecStart=/usr/bin/podman container run --rm \ --name tileserver -u www-data -p 8083:8080 \ -v /vagrant_data/resources/tiles:/data \ maptiler/tileserver-gl:v3.1.1 \ -c /etc/tileserver.json \ --public_url https://devserver.local/tiles
[Install] WantedBy=default.target
/etc/containers/containers.conf:
[containers] log_driver="journald" tz="local" [network] network_backend="netavark"
registries.conf and policy.json are minimal and have nothing related to this issue.
When I run the service and do `journalctl -u tileserver`, this is what gets logged after the container has been pulled and started:
Aug 17 14:53:51 mapapi-dev tileserver[11742]: Starting tileserver-gl v3.1.1 Aug 17 14:53:51 mapapi-dev podman[11671]: Starting tileserver-gl v3.1.1 Aug 17 14:53:51 mapapi-dev tileserver[11742]: No MBTiles specified, using zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev podman[11671]: No MBTiles specified, using zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev tileserver[11742]: [INFO] Automatically creating config file for zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev tileserver[11742]: [INFO] Only a basic preview style will be used. Aug 17 14:53:51 mapapi-dev podman[11671]: [INFO] Automatically creating config file for zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev podman[11671]: [INFO] Only a basic preview style will be used. Aug 17 14:53:51 mapapi-dev podman[11671]: [INFO] See documentation to learn how to create config.json file. Aug 17 14:53:51 mapapi-dev tileserver[11742]: [INFO] See documentation to learn how to create config.json file. Aug 17 14:53:51 mapapi-dev tileserver[11742]: Run with --verbose to see the config file here. Aug 17 14:53:51 mapapi-dev podman[11671]: Run with --verbose to see the config file here. Aug 17 14:53:51 mapapi-dev tileserver[11742]: Starting server Aug 17 14:53:51 mapapi-dev podman[11671]: Starting server Aug 17 14:53:51 mapapi-dev tileserver[11742]: Listening at http://[::]:8080/ Aug 17 14:53:51 mapapi-dev podman[11671]: Listening at http://[::]:8080/ Aug 17 14:53:51 mapapi-dev tileserver[11742]: Startup complete Aug 17 14:53:51 mapapi-dev podman[11671]: Startup complete
So, everything that tileserver prints to stdout, podman repeats. If I run the container as a simple terminal command outside systemd, everything is only printed out once.
Any ideas for a fix? I don't particularly care whether it's the 'tileserver' or 'podman' rows out of the duplicated ones that end up in the logs, but I'd rather not have both logged. _______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
Hi Jklaiho, Look at systemd unit file generated by: podman generate systemd The type has to be "forking": [Service] Type=forking Kind regards, Rudolf Vesely
Hi Rudolf, Yep, that did it. Thank you! I had missed that command entirely. For reference, I eventually ended up using --new with this unit since I'm fine with the container being created and removed on every start and stop. Type=notify is used in the this case, and it works equally well. - JKL
On Thu, Aug 18, 2022 at 07:33:05AM +0000, Rudolf Vesely via Podman wrote:
I'm experimenting with Podman on a Ubuntu 22.04 Vagrant box. I installed Podman and its dependencies manually from GitHub releases rather than using the outdated version in the Ubuntu repositories. This means I had to rely on web sources for my configuration files, and I may have gotten something a bit wrong.
Here's the systemd service file:
[Unit] Description=TileServer GL After=network-online.target Requires=network-online.target
[Service] Restart=always ExecStartPre=/usr/bin/podman pull maptiler/tileserver-gl:v3.1.1 ExecStart=/usr/bin/podman container run --rm \ --name tileserver -u www-data -p 8083:8080 \ -v /vagrant_data/resources/tiles:/data \ maptiler/tileserver-gl:v3.1.1 \ -c /etc/tileserver.json \ --public_url https://devserver.local/tiles
[Install] WantedBy=default.target
/etc/containers/containers.conf:
[containers] log_driver="journald" tz="local" [network] network_backend="netavark"
registries.conf and policy.json are minimal and have nothing related to this issue.
When I run the service and do `journalctl -u tileserver`, this is what gets logged after the container has been pulled and started:
Aug 17 14:53:51 mapapi-dev tileserver[11742]: Starting tileserver-gl v3.1.1 Aug 17 14:53:51 mapapi-dev podman[11671]: Starting tileserver-gl v3.1.1 Aug 17 14:53:51 mapapi-dev tileserver[11742]: No MBTiles specified, using zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev podman[11671]: No MBTiles specified, using zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev tileserver[11742]: [INFO] Automatically creating config file for zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev tileserver[11742]: [INFO] Only a basic preview style will be used. Aug 17 14:53:51 mapapi-dev podman[11671]: [INFO] Automatically creating config file for zurich_switzerland.mbtiles Aug 17 14:53:51 mapapi-dev podman[11671]: [INFO] Only a basic preview style will be used. Aug 17 14:53:51 mapapi-dev podman[11671]: [INFO] See documentation to learn how to create config.json file. Aug 17 14:53:51 mapapi-dev tileserver[11742]: [INFO] See documentation to learn how to create config.json file. Aug 17 14:53:51 mapapi-dev tileserver[11742]: Run with --verbose to see the config file here. Aug 17 14:53:51 mapapi-dev podman[11671]: Run with --verbose to see the config file here. Aug 17 14:53:51 mapapi-dev tileserver[11742]: Starting server Aug 17 14:53:51 mapapi-dev podman[11671]: Starting server Aug 17 14:53:51 mapapi-dev tileserver[11742]: Listening at http://[::]:8080/ Aug 17 14:53:51 mapapi-dev podman[11671]: Listening at http://[::]:8080/ Aug 17 14:53:51 mapapi-dev tileserver[11742]: Startup complete Aug 17 14:53:51 mapapi-dev podman[11671]: Startup complete
So, everything that tileserver prints to stdout, podman repeats. If I run the container as a simple terminal command outside systemd, everything is only printed out once.
Any ideas for a fix? I don't particularly care whether it's the 'tileserver' or 'podman' rows out of the duplicated ones that end up in the logs, but I'd rather not have both logged. _______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
Hi Jklaiho,
Look at systemd unit file generated by: podman generate systemd
The type has to be "forking":
[Service] Type=forking
Huh! I never knew this, and having read the description of forking in "man systemd.service", I really don't get how it's relevant to log output behaviour, and I'd love an explanation. What I do is "podman run --log-driver=none", fwiw, which is a bit annoying because "podman logs" doesn't work.
participants (3)
-
jklaiho@iki.fi -
Robin Lee Powell -
Rudolf Vesely