Note:

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:

What Do You Need?

Install the Podman Package

Note: When using the free lab environment, see Oracle Linux Lab Basics for connection and other usage instructions.

  1. Open a terminal and connect to your Oracle Linux 8 instance.

  2. 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.

  3. Type y to proceed with the installation.

    Installation of the container-tools module completes.

  4. Check the podman configuration and version.

    podman info
    

    info output

  5. 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
    

    man page

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.

  1. Listing the existing images in local storage.

    podman images
    

    images output

  2. Pull the oraclelinux:8-slim image.

    podman pull os/oraclelinux:8-slim
    

    pull output

    The image downloads to local system storage.

  3. Verify the image downloaded.

    podman images
    

    images output

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.

  1. Create an interactive container running the bash shell.

    podman run --rm -it oraclelinux:8-slim
    

    run2 results

    You are presented a bash terminal where you can run Linux commands within the container.

  2. Exit the container.

    exit
    

    The container is automatically removed after execution due to using the --rm option.

  3. Run the same command again, without the --rm option.

    podman run -it oraclelinux:8-slim
    

    run results

  4. Exit the container as before.

  5. Get a list of all containers in local storage.

    podman ps -a
    

    The -a ensures the output shows both running and non-running containers.

    ps output

Remove Existing Container and Image

Remove the container and image used in the lab leaving a clean environment.

  1. Remove the container created.

    podman rm <CONTAINER_ID>
    

    Where the <CONTAINER_ID> is determined by running podman ps -a.

    rm_output

  2. Verify the container was removed.

    podman ps -a
    

    ps_verify

  3. Remove the downloaded Oracle Linux 8 Slim image.

    podman rmi <IMAGE_ID>
    

    Where the <IMAGE_ID> is determined by running podman images.

    rmi output

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.