Installing Podman

  1. Let’s download the latest Podman binaries and extract them to set up Podman on our host. Note: If you are running Ubuntu 20.10 or higher, you can simply use the package manager to install Podman.
student@ubuntu:~$ curl -fsSL -o podman-linux-amd64.tar.gz \
>
https://github.com/mgoltzsche/podman-static/releases/latest/download/podmanlinux-amd64.tar.gz
student@ubuntu:~$ tar -xf podman-linux-amd64.tar.gz
student@ubuntu:~$ sudo cp -r podman-linux-amd64/usr podman-linux-amd64/etc /
student@ubuntu:~$ sudo ln -s /usr/bin/podman /usr/local/bin/podman
  1. Verify the Podman installation:
student@ubuntu:~$ podman --version
podman version 4.8.2
  1. To explore all the available options with Podman, execute:
student@ubuntu:~$ podman --help
Usage:
podman [options] [command]
Available Commands:
attach Attach to a running container
auto-update Auto update containers according to their auto-update policy
build Build an image using instructions from Containerfiles
commit Create new image based on the changed container
compose Run compose workloads via an external provider such as
docker-compose or podman-compose
container Manage containers
cp Copy files/folders between a container and the local
filesystem
create Create but do not start a container
diff Display the changes to the object's file system
events Show podman system events
exec Run a process in a running container
export Export container's filesystem contents as a tar archive
generate Generate structured data based on containers, pods or volumes
healthcheck Manage health checks on containers
help Help about any command
<Output Truncated>
  1. List the existing container, by executing the following command:
student@ubuntu:~$ sudo podman container ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
  1. Create a container, by executing the following command:
student@ubuntu:~$ sudo podman container run hello-world
✔ docker.io/library/hello-world:latest
Trying to pull docker.io/library/hello-world:latest...
Getting image source signatures
Copying blob c1ec31eb5944 done |
Copying config d2c94e258d done |
Writing manifest to image destination
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent
it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
  1. We can list the available images on our host by executing the following command:
student@ubuntu:~$ sudo podman image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/hello-world latest d2c94e258dcb 8 months ago 26.3
kB
  1. An Image can be built using Podman as well. We will use the same Dockerfile as in the earlier lab exercise.
student@ubuntu:~$ sudo podman image build . -t nginx:podman
STEP 1/4: FROM nginx
✔ docker.io/library/nginx:latest
Trying to pull docker.io/library/nginx:latest...
Getting image source signatures
Copying blob af107e978371 done |
Copying blob 5e99d351b073 done |
Copying blob 336ba1f05c3e done |
Copying blob 8c37d2ff6efa done |
Copying blob 51d6357098de done |
Copying blob 782f1ecce57d done |
Copying blob 7b73345df136 done |
Copying config d453dd892d done |
Writing manifest to image destination
STEP 2/4: COPY . /usr/share/nginx/html
--> 95fa83a8887f
STEP 3/4: EXPOSE 80/tcp
--> aecf247e1625
STEP 4/4: CMD ["nginx", "-g daemon off;"]
COMMIT nginx:podman
--> 7958e43aed3c
Successfully tagged localhost/nginx:podman
7958e43aed3c9591ca7ab5cae328dfdc8344a8a5420b07ac473bed169319869d
  1. Podman provides a command line interface (CLI) familiar to anyone who has used the Docker Container Engine. Most users can simply alias Docker to Podman (alias docker=podman) without any problems. Explore further options and commands using Podman.