Podman

From SME Server
Jump to navigationJump to search







podman
NeedImage.svg
Podman logo
MaintainerReetP
Urlhttps://podman.io/
Source: smeserver-podman
Licenceopen source
Category

Administration

Tags Containers


Warning.png Work in Progress:
This page is a Work in Progress. The contents off this page may be in flux, please have a look at this page history the to see list of changes.


Placeholder for anything to do with Podman (https://podman.io/)

Important.png Note:
Initial note only



Version

smecontribs-testing 11:
smeserver-podman
The latest version of smeserver-podman is available in the SME repository, click on the version number(s) for more information.


About

According to wikpedia:

Podman (pod manager) is an open source Open Container Initiative (OCI)-compliant container management tool created by Red Hat used for handling containers, images, volumes, and pods on the Linux operating system, with support for macOS and Microsoft Windows via a virtual machine.[4] Based on the libpod library, it offers APIs for the lifecycle management of containers, pods, images, and volumes. The API is identical to the Docker API. Podman Desktop provides an alternative to Docker Desktop.

Installation

Use something like:

dnf --enablerepo=* install smeserver-podman podman-compose

This will enable you to use compose type files.

Configuration

config show podman

podman=service
   iptables=false
   status=enabled

Users

I needed a group to add local users, and a user for the container I was running but didn't want the user to be a normal Koozali SME user.

If you add a group the system will create a user for you. So we can use it like this:

mkdir -p /home/ncclient
db accounts set ncclient group Description NCClient Gid 9001 Members admin Uid 9001
signal-event group-create ncclient
usermod -s /bin/bash -d /home/ncclient ncclient

Now we have a user that podman can use, and a group we can add other users too.

Usage

Creating your own build eg:

cd /home/e-smith/files/podman/configs
# Build an image you can refer to in your compose file
podman build -f DockerfileES --network host -t nextcloudcmd-es .
#Start the container named in your compose file
podman compose up -d occlientes
podman compose down occlientes
# or 
podman compose stop occlientes

# Cleanup etc 
podman images
podman ps -a
podman rm occlientes
podman rmi $(podman images -qa) -f
podman system prune --all --volumes -f
podman volume ls --filter dangling=true


Sample compose file

 occlientes:
   container_name: occlientes
   image: nextcloudcmd-es
   env_file: ".env"
   logging:
     #driver: journald
     options:
       max-size: "50mb"
   volumes:
     - ${VOLUME_MAPPING:-/home:/home}
     - /opt/Nextcloud/log:/opt/Nextcloud/log
     - /etc/localtime:/etc/localtime:ro
   environment:
     - NEXTCLOUD_USER=${NEXTCLOUD_USER:-admin}
     - NEXTCLOUD_PASS=${NEXTCLOUD_PASS:-none}
     - NEXTCLOUD_PROTO=${NEXTCLOUD_PROTO:-https}
     - NEXTCLOUD_SERVER=${NEXTCLOUD_SERVER:-www.nextcloud.com}
     - NEXTCLOUD_URLPATH=${NEXTCLOUD_URLPATH:-/}
     - NEXTCLOUD_WEBDAV=${NEXTCLOUD_WEBDAV:-""}
     - NEXTCLOUD_FILEPATH=${NEXTCLOUD_FILEPATH:-/}
     - TRUST_SELFSIGN=${TRUST_SELFSIGN:-0}
     - SYNC_HIDDEN=${SYNC_HIDDEN:-0}
     - SILENCE_OUTPUT=${SILENCE_OUTPUT:-0}
     - RUN_INTERVAL=${RUN_INTERVAL:-120}
     - DEBUG=${DEBUG:-0}
     - RUN_UID=${RUN_UID:-9001}
     - RUN_GID=${RUN_GID:-9001}

This uses a .env file

Autostart

Unlike docker, podman containers do not autostart on reboot.

You have to generate a systemd unit file eg:

podman generate systemd --new --name occlientes -f

It really just generates a podman run command with all the env variables eg:

ExecStart=/usr/bin/podman run \

Not great it you are changing settings as you need to keep remembering to regenerate the file.

Set a key for the container so it becomes an integrated service:

config set container-occlientes service status enabled

Build your container - use host mode or you have to add a known network for the bridge so the container can access DNS:

cd /home/e-smith/files/podman/configs; podman build -f DockerfileES --network host -t nextcloudcmd-es .

Start it:

podman compose up -d occlientes

Generate a unit file:

podman generate systemd --new --name occlientes -f

Chnage the WantedBy part:

sed -i 's/default.target/sme-server.target/g' container-occlientes.service

Copy it to the systemd dir:

cp /home/e-smith/files/podman/configs/container-occlientes.service /etc/systemd/system

Reload system, 'restart' the service, and see that it is running:

systemctl daemon-reload
systemctl restart container-occlientes.service 
systemctl status container-occlientes.service 


Post-upgrade and reboot and it should be up and running.

We really need a separate DB for containers.

Bugs

Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-podman component or use this link


IDProductVersionStatusSummary
13455SME Contribs11.0CONFIRMEDFirst import to Koozali SME v11 smeserver-podman


Changelog

Only versions released in smecontrib are listed here.