url:Podman Installation | Podman
Podman is a daemon-less, open-source, Linux native tool. Designed to make it easy to find, run, build, share, and deploy applications using OCI (Open Container Initiative) containers and container images.
Podman features:
1) Rootless containers (security layer) - not allowing root access even if a container is compromised
2) Multi containers Pods (which can be exported as Kubernetes manifest)
3) Deamonless - interact directly with runc
CLI (open source tool for spawning and running containers)
If you are not familiar with CLI tools, there is the Podman Desktop version (Podman Desktop - Containers and Kubernetes | Podman Desktop), for running the containers and Kubernetes from desktop GUI.
Install Podman:
```
Ubuntu:
sudo apt update
sudo apt install podman
podman info
podman version
Arch:
yay -Syuyay -S podman
podman info
podman version
===== or useing Pacman ====
sudo pacman -Syu
sudo pacman -S podman
podman info
podman version
Notice: Podman on MacOS and Windows requires a virtual machine.
Podman uses the container registry
(docker hub, GitHub, redhat container registered).
This file is located in/etc/containers/registries.conf
Podman uses this file when wants to pull or push the images.
Instead of changing the registry for every user or for every project.
You can have "$HOME/.config/containers/registries.conf"
which will hold your custom registry.
makedir .config/containersnano ./config/containers/registries.conf
To the file, we should add:
unqualified-search-registries = ['docker.io', 'ghrc.io', 'quay.io']
So let's take a breath and explain what we have done now:
podman search <image_name>
This command enables us to search the images from specific registries
podman search home-assistant
In the search result, you should see all listed images from each registry that you mention inside the unqualified array
```
docker.io/vwieczorek/home-assistant-ecovacs-fix FROM https://github.com/home-assistant/home-...docker.io/kiall/home-assistant My home-assistant.io containerdocker.io/ngalayko/home-assistant
docker.io/molobrakos/home-assistant Home Assistantdocker.io/chrisjaure/home-assistant-arm home-assistant image that runs on arm.docker.io/pschmitt/home-assistant-addon-aarch64-flicd
docker.io/pschmitt/home-assistant-addon-amd64-zabbix-agent2
docker.io/pschmitt/home-assistant-addon-armhf-flicd
quay.io/kevchu3/home-assistant
quay.io/truecharts/home-assistant
quay.io/thoraxe/home-assistant
quay.io/joejulian/image-home-assistant
quay.io/webhookrelay/home-assistant-armhf
quay.io/webhookrelay/home-assistant-aarch64
quay.io/webhookrelay/home-assistant-amd64
quay.io/fphammerle/home-assistant
quay.io/rbo/home-assistant-addon-dnsmasq
quay.io/cznewt/home-assistant
```
Let's get a bit deeper with podman commands:
podman --help
// search the images from specified registries podman
podman search <image_name>
// install the image from registry
pull <image_name>
// list the images which you have installed
podman images
When you pick the image that you want to run locally as a container, there is a set of commands to provide a container running:
// allocate terminal session to interact with container
podman run -it --rm <image_name>
// list all running containers
podman ps
// list all containers
podman ps -a
Let's explore which actions can we do to manipulate the containers:
/* Download and run the container map the internal to external port */
podman run --name <container_name> \ -p ext_port:int_port <container_image>
/* This command start the container running in the background with the passed container name */
podman start <container_name>
/* Provide all information of the container and other details which are configured */
podman inspect <container_name>
/* Show the mapped port configuration */
podman port <container_name>
/* Stop the container running process */
podman stop <container_name>
/* Remove the container by the name */
podman rm <container_name>
/* Remove the container image by IMAGE_ID */
podman rmi <container_image>
Let''s test those commands by introducing the Nginx image:
```
podman search nginx
podman run --name pdm-nginx -p 8080:80 nginx
~/ ctrl + c
podman run pdm-nginx
podman inspect pdm-nginx
podman port pdm-nginx
~/ curl localhost:8080 // to check the working of the nginx
podman stop pdm-nginx
podman ps // we should see the non active container
podman rm pdm-nginx // to remove container
podman images
podman rmi <IMAGE_ID>
```