Podman CLI Guide for Docker Users

Podman CLI Guide for Docker Users

The first part of this tutorial focuses on similarities between Podman and Docker. In the second part of this tutorial, we'll walk you through two of the most important features that differentiate Podman from Docker.

Podman is the command-line interface tool that lets you interact with Libpod, a library for running and managing OCI-based containers. It is important to note that Podman doesn't depend on a daemon, and it doesn't require root privileges.

The first part of this tutorial focuses on similarities between Podman and Docker, and we'll show how you can do the following:

  • Move a Docker image to Podman.
  • Create a bare-bones Nuxt.JS project and build a container image for it
  • Push your container image to Quay.io
  • Pull the image from Quay.io and run it with Docker.

In the second part of this tutorial, we'll walk you through two of the most important features that differentiate Podman from Docker. In this section, you will do the following:

  • Create a Pod with Podman
  • Generate a Kubernetes Pod spec with Podman, and deploy it to a Kubernetes cluster.

Prerequisites

1. This tutorial is intended for readers who have prior exposure to Docker. In the next sections, you will use commands such as run, build, push, commit, and tag. It is beyond the scope of this tutorial to explain how these commands work.

2. A running Linux system with Podman and Docker installed.

You can enter the following command to check that Podman is installed on your system:

podman version
Version:            1.6.4
RemoteAPI Version:  1
Go Version:         go1.12.12
OS/Arch:            linux/amd64

Refer Podman Installation Instructions for details on how to install Podman.

Use the following command to verify if Docker is installed:

docker --version
Docker version 18.06.3-ce, build d7080c1

See the Get Docker page for details on how to install Docker.

3.** Git**. To check if Git is installed on your system enter, type the following command:

git version
git version 2.18.2

You can refer Getting Started - Installing Git on details of installing Git.

4.** Node.js 10** or higher. To check if Node.js is installed on your computer, type the following command:

node --version
v10.16.3

If Node.js is not installed, you can download the installer from the Downloads page.

  1. A Kubernetes Cluster. If you don’t have a running Kubernetes cluster, refer the “Create a Kubernetes Cluster with Kind” section.
  2. Additionally, you will need a Quay.io account.

Moving Images from Docker to Podman

If you've just installed Podman on a system on which you've already used Docker to pull one or more images, you'll notice that running the 

podman images command doesn't show your Docker images:

docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
cassandra           latest              b571e0906e1b        10 days ago         324MB
podman images
REPOSITORY   TAG   IMAGE ID   CREATED   SIZE

The reason why you don't see your Docker images is that Podman runs without 

root privileges. Thus, its repository is located in the user's home directory - ~/.local/share/containers. However, Podman can import an image directly from the Docker daemon running on your machine, through the docker-daemon  transport.

In this section, you'll use Docker to pull the 

hello-world image. Then, you'll import it into Podman. Lastly, you'll run the hello-world image with Podman.

1. Download and run the 

hello-world image by executing the following command:

sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:9572f7cdcee8591948c2963463447a53466950b3fc15a247fcad1917ca215a2f
Status: Downloaded newer image for hello-world:latest

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/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

2. The following 

docker images command lists the Docker images on your system and pretty-prints the output:

sudo docker images --format '{{.Repository}}:{{.Tag}}'
hello-world:latest

3. Enter the 

podman pull command specifying the transport (docker-daemon) and the name of the image, separated by ::

podman pull docker-daemon:hello-world:latest
Getting image source signatures
Copying blob af0b15c8625b done
Copying config fce289e99e done
Writing manifest to image destination
Storing signatures
fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e

4. Once you've imported the image, running the 

podman imagescommand will display the hello-world image:

podman images
REPOSITORY                      TAG      IMAGE ID       CREATED         SIZE
docker.io/library/hello-world   latest   fce289e99eb9   13 months ago   5.94 kB

5. To run the image, enter the following 

podman run command:

podman run hello-world
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/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

security docker cloud-computing buildah podman containers containerization hackernoon-top-story

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Advanced Docker Security with AppArmor - An Overview

For the interest of the organization, it remains extremely crucial to keep not only the Containers but also the hosted applications protected from security threats. By default, a deployed Docker originally remains secured through an auto-generated profile docker-default for its containers.

Multi-cloud Spending: 8 Tips To Lower Cost

Mismanagement of multi-cloud expense costs an arm and leg to business and its management has become a major pain point. Here we break down some crucial tips to take some of the management challenges off your plate and help you optimize your cloud spend.

Top Cloud Computing Service Providing Companies Reviews

Here is the list of Top Cloud Computing service providers who can give your business a new shift. Cloud technology is the new phase of business augmentation where the tailored business needs are taken forward to resolve various resource security...

Cloud Security: Is it Worth it?

Storing and managing corporate data by applying the cloud is becoming more and more popular. Companies grow, and it gets too expensive, and resources consuming to store their data on traditional servers. To prove it, look at the research conducted by Google in 2019 that includes insights for the cloud computing market for the next 10 years.

Confidential Computing in the Cloud

How Confidential Computing could help bring everyone to the cloud. Security is one of the most important pillars for an organization.