The alternative of docker as docker is no longer free for enterprise users.

Installation

Podman Installation | Podman

Install from download

wget <https://github.com/containers/podman/releases/latest/download/podman-remote-static-linux_amd64.tar.gz>
tar -xvzf podman-remote-static-linux_amd64.tar.gz
sudo mv ./bin/podman-remote-static-linux_amd64 /usr/local/bin/podman
sudo chmod +x /usr/local/bin/podman

Examples

# If you want to keep your existing volumns, you should use --userns=keep-id,
# otherwise, it might throw "operation not permitted" when start a container
podman run -d --name my-container --userns=keep-id \\
    -v /your-path:/path
	image-name

Configure sources

Open /etc/containers/registries.conf and uncomment below line, so that you can pull images from other sources.

unqualified-search-registries = ["registry.fedoraproject.org", "registry.access.redhat.com", "docker.io"]

Jenkins in Podman

Run podman in jenkins pipeline if jenkins is running in container

Mount the socket of podman into jenkins container.

docker run -d \\
  --name my-jenkins \\
  -p 8080:8080 \\
  -v /home/<host_user>/jenkins_home:/var/jenkins_home \\
  -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock \\
  bndynet/jenkins

Then run it in pipeline:

pipeline {
    agent any
    stages {
        stage('Run Podman') {
            steps {
                sh 'export PODMAN_HOST=unix:///run/user/1000/podman/podman.sock && podman run --rm hello-world'
            }
        }
    }
}

Let jenkins account run podman

sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 jenkins