Portainer is a popular OCI container management platform.
For resource limited devices, installing Portainer Agent on the device allows it to be managed from a Portainer server.
The Portainer documentation describes how to install Portainer Agent on Podman. This article extends that example by describing how to install Portainer Agent on a PLCnext Control device using Podman Quadlets.
By using Podman Quadlets, containers and volumes can be managed as systemd services.
Notes and disclaimers:
- This procedure requires a PLCnext Control device with firmware version 2025.0 or later.
- The PLCnext Control device must be connected to the internet in order to download the Portainer Agent OCI image.
- At the time of writing, Portainer only supports Podman running on the CentOS 9 operating system, which does not include PLCnext Control devices.
- Phoenix Contact generally recommends that Podman on PLCnext Control devices is only used by PLCnext Store apps. The use of Podman for any other purpose is currently not supported by Phoenix Contact.
- Devices running Portainer Agent can be managed from a full version of Portainer - either the Business Edition or the Community Edition - installed on a separate device. The management of Portainer Agent devices is covered in the Portainer documentation, and is not described in this article.
Procedure
-
On the PLCnext Control device, create the file
/etc/containers/systemd/portainer.volume
with the following content:[Unit] Description=Portainer Agent Container Volume [Volume] VolumeName=portainer
-
Create the file
/etc/containers/systemd/portainer_agent.container
with the following content:[Unit] Description=Portainer Agent Container Requires=portainer-volume.service [Container] ContainerName=portainer_agent Image=docker.io/portainer/agent:2.23.0 Volume=/run/podman/podman.sock:/var/run/docker.sock Volume=/var/lib/containers/storage/volumes:/var/lib/docker/volumes Volume=/:/host PublishPort=9001:9001 [Install] WantedBy=multi-user.target default.target
-
Execute the following commands from the root user account:
systemctl daemon-reload systemctl start portainer_agent.service
Starting the service takes a while the first time, because the complete Portainer Agent image is loaded from docker.io.
-
Check that the service has started successfully, using the following command:
systemctl status portainer_agent.service
While the container is running, you can connect to the Portainer Agent on the PLCnext Control device from a Portainer Server, as described in the Portainer documentation.
By implementing the container in this way, Portainer Agent will automatically restart every time the PLCnext Control device restarts.
References
-
Portainer documentation: "Install Portainer Agent on Podman"
-
Daniel Schier: "Podman - Quadlets"
Leave a Reply
You must be logged in to post a comment.