Note:
- This tutorial is available in an Oracle-provided free lab environment.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
Get started with Podman
Introduction
This lab gets you started using Podman on Oracle Linux 8 or later. You will install Podman, pull an image from a repository, and use the image to run a container.
Objectives
In this lab, you’ll:
- Install Podman
- Pull an image from a repository
- Run a container using the pulled image
What Do You Need?
- A running system with Oracle Linux 8 installed
Install the Podman Package
Note: When using the free lab environment, see Oracle Linux Lab Basics for connection and other usage instructions.
-
Open a terminal and connect to your Oracle Linux 8 instance.
-
Install the container-tools module.
sudo dnf module install container-tools:ol8
This command will install the container-tools module which contains podman (if not already installed) and other tools, including skopeo and buildah.
One essential tool is container-selinux which allows running
podman
as a non-root user on a SELinux enabled system.Dnf will display the container-tools module information, including a list of packages that will be installed and any dependencies.
-
Type
y
to proceed with the installation.Installation of the container-tools module completes.
-
Check the podman configuration and version.
podman info
-
The Podman commands can be run as a regular user, or as a sudo user with elevated privileges. To see further command details use the podman manual pages.
man podman
Pull the Oracle Linux 8 Slim Image
Container images are hosted in a repository. By default, podman and skopeo on Oracle Linux 8 are configured to use the Oracle Container Registry, Docker Hub, Quay.io, Fedora, and CentOS registries.
-
Listing the existing images in local storage.
podman images
-
Pull the
oraclelinux:8-slim
image.podman pull os/oraclelinux:8-slim
The image downloads to local system storage.
-
Verify the image downloaded.
podman images
Run the Oracle Linux 8 Slim Image
Start a container using the oraclelinux:8-slim
image. The container in this lab will run an interactive bash terminal.
-
Create an interactive container running the bash shell.
podman run --rm -it oraclelinux:8-slim
You are presented a bash terminal where you can run Linux commands within the container.
-
Exit the container.
exit
The container is automatically removed after execution due to using the
--rm
option. -
Run the same command again, without the
--rm
option.podman run -it oraclelinux:8-slim
-
Exit the container as before.
-
Get a list of all containers in local storage.
podman ps -a
The
-a
ensures the output shows both running and non-running containers.
Remove Existing Container and Image
Remove the container and image used in the lab leaving a clean environment.
-
Remove the container created.
podman rm <CONTAINER_ID>
Where the <CONTAINER_ID> is determined by running
podman ps -a
. -
Verify the container was removed.
podman ps -a
-
Remove the downloaded Oracle Linux 8 Slim image.
podman rmi <IMAGE_ID>
Where the <IMAGE_ID> is determined by running
podman images
.
More Learning Resources
Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.
For product documentation, visit Oracle Help Center.