Podman
Introduction
Section titled “Introduction”Podman & Podman Compose
Section titled “Podman & Podman Compose”Podman Compose tool allows you to define and manage multi-container applications using a
compose.yamlfile. It’s built on top of Podman, a daemonless container engine that provides rootless containers for enhanced security. Unlike Docker Compose, Podman Compose does not rely on a central daemon, making it more lightweight and secure. Podman Compose is compatible with Docker Compose files: you can use your existingcompose.yamlfiles with minor changes.
sudo apt install podman podman-composeAdd default search registry by editing the registries file:
sudo nano /etc/containers/registries.confAt the bottom of the file, add the following lines:
[registries.search]registries = ['docker.io', 'quay.io']You could also append 'docker.io to compose’s image parameter to avoid this setting.
You can start containers on boot using Quadlet: I suggest you to use Podman Quadlets with Podman Desktop
Podman Desktop
Section titled “Podman Desktop”It is quite instable.
Podlet
Section titled “Podlet”sudo apt install cargo
cargo install podletIf the installation completes succesfully, you should get an output like this:
Finished `release` profile [optimized] target(s) in 4m 49s Installing /home/pit/.cargo/bin/podlet Installed package `podlet v0.3.0` (executable `podlet`)warning: be sure to add `/home/pit/.cargo/bin` to your PATH to be able to run the installed binariesAppend to your configuration file (~/.bashrc or ~/.zshrc) the following line:
export PATH=/home/$USER/.cargo/bin:$PATHCreate .container file based on compose.yaml file:
cd your-project
# build the Dockerfile separatelypodman build -t pit-blog . -f Dockerfile.node
podlet compose compose.yamlYou’ll get as output a file like:
[Container]ContainerName=pit-blogImage=docker.io/node:latestNetwork=defaultPublishPort=1111:4321Volume=.:/usr/src/appVolume=/usr/src/app/node_modules
[Service]Restart=always
---
# default.network[Network]Driver=bridgeAs you can see, it is giving two different files: node.container and default.network.
You should keep your network settings into a different file because systemd unit files don’t support a [Network] section.
You can take inspiration from those files to craete your own.
In in the case of an Astro.js blog based on Node, you can move into /home/$USER/.config/containers/systemd/ and create the following files:
Unit]Description=Pit Blog - Astro js
[Install]WantedBy=default.target
[Container]ContainerName=pit-blogImage=localhost/pit-blogNetwork=defaultPublishPort=1111:4321Volume=%h/pietropoluzzi:/usr/src/appVolume=%h/pietropoluzzi/node_modules:/usr/src/app/node_modules
[Service]Restart=alwaysAnd the network file:
[Network]Driver=bridgeThen enable the container to run as a systemctl service:
systemctl --user daemon-reload
systemctl --user status pit-blog.service
# if you cannot the service up and running, rebootsudo rebootTL;DN
- move into the project root:
cd your-project - build the Dockerfile separately:
podman build -t pit-blog . -f Dockerfile.node - get the podlet-generated files:
podlet compose compose.yaml - make some minor changes, then create
.containerand.networkfiles - reboot the system