Playing around with Podman

1
alias docker="sudo podman $1"

The above command works as of this time and podman makes namespaces for every users for every resources, i.e., images, containers and so on.

It means, podman images and sudo podman images will show different resources.😎

1
2
3
4
5
sudo podman pod create --name my-pod -p 8080:80
sudo podman run -d --restart=always --pod=my-pod --name my-nginx nginx
sudo podman run -d --restart=always --pod=my-pod --name my-curl curl
sudo podman generate kube my-pod > my-pod.yaml
sudo podman play kube ./my-pod.yaml

The generated file can not be used as raw. Below is an example of a manually edited version.

apiVersion: v1
kind: Pod
metadata:
labels:
app: my-pod
name: my-pod
spec:
containers:
- image: docker.io/library/nginx:latest
name: my-nginx
ports:
- containerPort: 80
hostPort: 8080
securityContext:
allowPrivilegeEscalation: true
privileged: false
readOnlyRootFilesystem: false
- image: docker.io/curlimages/curl:latest
name: my-curl
command: ["/bin/sh"]
args: ["-c", "echo Hello from the sidecar container; sleep 300"]
securityContext:
allowPrivilegeEscalation: true
privileged: false
readOnlyRootFilesystem: false
runAsGroup: 101
runAsUser: 100
restartPolicy: Always

Install Podman on CentOS 8

1
2
3
4
5
6
sudo dnf -y update
sudo dnf -y module disable container-tools
sudo dnf -y install 'dnf-command(copr)'
sudo dnf -y copr enable rhcontainerbot/container-selinux
sudo curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_8/devel:kubic:libcontainers:stable.repo
sudo dnf -y install podman

Happy containerizing! 😎