Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Podman - The next generation of Linux container tools

November 19, 2018
Doug Tidwell
Related topics:
ContainersLinux
Related products:
Red Hat OpenShift

    podman is an open-source Linux tool for working with containers. That includes containers in registries such as docker.io and quay.io. In this article, I'll show you how to use podman to build a container image and create a container from it. Next, I'll show you how to upload the image to a registry, and finally, I'll show you how to use docker to create a container on a non-Linux system using the fully-compatible image I created with podman. 

    The podman logo

     

    Before we begin, a quick word about the name of the project and its logo. podman works with containers, as I'll show you, but it also works with pods, groups of containers that are deployed together on the same host. (If you know about Kubernetes pods, you're familiar with how podman pods work.) More importantly, a group of seals is called a pod, hence the awesome podman logo above. We won't talk about pods here (we'll cover them soon, I promise), but they're a great feature of the tool. 

     

    Enough background, let's move on. 

     

    The first step, of course, is to install podman. As usual a sensible first step is to run an update for good system hygiene:

     

    [doug@fedora-server28 Documents]$ sudo dnf -y update

     

    With your system up-to-date, go ahead and install podman: 

     

    [doug@fedora-server28 Documents]$ sudo dnf -y install podman

     

    (Obviously use yum or apt-get or whatever your distro uses to install and manage software.)

     

    If you're ready to go all-in with podman, you can add alias docker=podman. That means that your Linux system will always invoke podman, even if you type docker out of habit. For research purposes, I run both docker and podman to show that they're compatible, so I haven't defined the alias. For what it's worth, Twitter user Alan Moran (not connected with yr. author in any way) defined the alias and had no problems whatsoever: 

    alias docker=podman: no worries.

    With the tool installed, start with sudo podman version to see the version you're using. I'm using version 0.9.3.1:

     

    [doug@fedora-server28 Documents]$ sudo podman version
    podman version 0.9.3.1

     

    podman isn't at version 1.0 yet, so keep that in mind. Also, I'm running podman as root here, although that may not be necessary with the version of podman you have. The goal for podman version 1.0 is that the command should never require root access. We'll talk more about root access shortly. 

     

    Next, run podman info to get some information about the environment:

     

    [doug@fedora-server28 Documents]$ sudo podman info
    . . .
      registries:
      - docker.io
      - registry.fedoraproject.org
      - quay.io
      - registry.access.redhat.com
      - registry.centos.org
    . . .

     

    The only detail I'll point out here is the fact that there are five registries that podman uses on this system. If you're trying to load a container image, it first looks on the local machine, then it checks the other registries in the order they're listed here. 

     

    Now, let's dive in to the good stuff. We'll take the Dockerfile below and use podman to build an image with it. The file copies the source of the Colossal Cave Adventure game into the container image (the WORKDIR and COPY commands), installs some kernel updates for security reasons (the first six lines of the RUN command), along with the packages you need to build the code (the next five lines of RUN), and finally, builds the code (the last line of RUN):

     

    FROM registry.centos.org/che-stacks/centos-stack-base
    
    WORKDIR /usr/src/open-adventure
    
    COPY ./open-adventure /usr/src/open-adventure
    
    RUN sudo yum -y update && \
        sudo yum -y install kernel-headers && \
        sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org && \
        sudo rpm -Uvh http://elrepo.org/linux/kernel/el7/x86_64/RPMS/elrepo-release-7.0-3.el7.elrepo.noarch.rpm && \
        sudo yum --enablerepo=elrepo-kernel -y install kernel-ml && \
        sudo yum --enablerepo=elrepo-kernel -y swap kernel-headers -- kernel-ml-headers && \
        sudo yum -y install centos-release-scl && \
        sudo yum -y install gcc && \
        sudo yum -y install make && \
        sudo yum -y install libedit-devel && \
        sudo yum -y install python-yaml && \
        sudo make
    
    CMD tail -f /dev/null 

     

    Building the container image is done with the command you'd expect: 

     

    [doug@fedora-server28 Documents]$ sudo podman build -t open-adventure:podman .
    STEP 1: FROM registry.centos.org/che-stacks/centos-stack-base
    Getting image source signatures
    Copying blob sha256:f9ce27a295e879233c8fbbf9ab67944a10e1ce80da69a46f87c583082a1ff3bb
    
    . . .
    
    STEP 8: CMD tail -f /dev/null 
    --> 9e5d996316fac25084c5fa4d62ff4cbebad39dd8913ca4aff46c53653589ec7
    STEP 9: COMMIT open-adventure:podman

     

    (As always, don't forget the dot at the end of the build command.) It will take a few minutes to pull the base image as well as all of the requirements, especially the first time you build the container image. It's anecdotal data, but in my experience building an image with podman doesn't seem any faster or slower than docker. 

     

    As you would expect, running podman images shows the image I just built:

     

    [doug@fedora-server28 Documents]$ sudo podman images
    REPOSITORY                                         TAG                 IMAGE ID            CREATED              SIZE
    localhost/open-adventure                           podman              a2b9a17504ac        About a minute ago   1.1GB
    registry.centos.org/che-stacks/centos-stack-base   latest              6e397c56690f        2 weeks ago          510MB

     

    Notice that localhost/ has been added to the name of the image. This tells podman that the image is in the image cache on the local machine. 

     

    Podman Quay Extra

     

    Next I'll create a container from the image. podman run --rm -it [the name of the image I just created] /bin/bash. This runs a bash shell when the container starts.

     

    [doug@fedora-server28 Documents]$ podman run --rm -it open-adventure:podman /bin/bash
    ssh-keygen: generating new host keys: RSA1 RSA DSA ECDSA ED25519
    [user@d767729eca88 open-adventure]$

     

    This also works if you add localhost/ to the start of the image name, but I left that out to make a point. (The point being that I'm lazy.) 

     

    Now I'm at a bash prompt inside the container that has Colossal Cave Adventure, as compiled when podman built the image. I can run ./advent and play the game. Go inside the building, get something to eat and drink, and quit the game. That sort of thing. 

     

    The point here is that I created an image that I can share with anybody who wants to play the game. You can, of course, build an image that contains useful software as well.

     

    And speaking of sharing, I'll put the image in the public repo at quay.io. First I'll use podman to log into my account:

     

    [doug@fedora-server28 Documents]$ sudo podman login quay.io -u dougtidwell -p [password]

     

    Now I can push my image from localhost into the quay.io repository:

     

    [doug@fedora-server28 Documents]$ sudo podman push open-adventure:podman quay.io/dougtidwell/open-adventure:podman

     

    Notice that when I push the image to quay.io, I have to specify the quay.io repo and my username (dougtidwell) as part of the remote image name.

     

    Now I'll go to the quay.io webpage for my container image: 

    The repository for the open-adventure container image

    Depending on the base operating system for your image, quay.io may run a scan for security vulnerabilities. I built the image tagged insecure with a modified Dockerfile that didn't install any kernel updates. That image has some vulnerabilities, and quay.io gave me the suggestions that helped me fix the problem. I left the old image around to make a point. (The point being that the security scan is pretty cool.)

     

    Finally, to wrap up the demo, let's go back to my Mac and use docker to pull the image from quay.io. Remember, podman is Linux only, so we have to use docker. With the same options I used on Linux just a minute ago, I can run that image and use it exactly as I did on Linux: 

     

    doug@dtidwell-mac:~/Developer/CLH/S2E1 $ docker run --rm -it open-adventure:podman /bin/bash
    ssh-keygen: generating new host keys: RSA1 RSA DSA ECDSA ED25519 
    [user@79fb285b6576 open-adventure]$ 

     

    The image is completely compatible. In fact, some of the libraries used by podman are also part of docker. 

     

    Before we go, a quick note about container architectures. docker runs as a daemon on Linux. That creates a certain amount of overhead, and it also requires anyone who wants to build a container image to have root access. That can create security risks, especially if your users know about the --privileged option of the docker run command.

     

    The daemon approach also stifles innovation in the container community. If you want to change the way containers work, you need to change the docker daemon and push those changes upstream. Without a daemon, the container infrastructure is more modular and it's easier to make changes. podman's daemon-less architecture is much more flexible and secure. 

     

    PodmanContainer Tools

     

    So that's a quick overview of podman. As you would expect, it's completely open source, Take a look at podman.io for documentation, presentations, and of course, the source code. We encourage you to install the tool on your Linux system and work with it. You can pull the container image I just built from my quay.io account and use it to play Colossal Cave Adventure, for example.

     

    Enjoy working with the next generation of container tools!

     

     

     

    Last updated: January 9, 2023

    Related Posts

    • Colossal Cave Adventure: Building and running 40-year-old code from the dawn of gaming

    • How to create a pull request: contributing to Open Source

    • Build your first application using PHP with Red Hat Container Development Kit (CDK)

    • Build your first application using Node.js with Red Hat Container Development Kit (CDK)

    Recent Posts

    • Debugging image mode with Red Hat OpenShift 4.20: A practical guide

    • EvalHub: Because "looks good to me" isn't a benchmark

    • SQL Server HA on RHEL: Meet Pacemaker HA Agent v2 (tech preview)

    • Deploy with confidence: Continuous integration and continuous delivery for agentic AI

    • Every layer counts: Defense in depth for AI agents with Red Hat AI

    What’s up next?

     

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.