DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Enterprise AI Trend Report: Gain insights on ethical AI, MLOps, generative AI, large language models, and much more.

2024 Cloud survey: Share your insights on microservices, containers, K8s, CI/CD, and DevOps (+ enter a $750 raffle!) for our Trend Reports.

PostgreSQL: Learn about the open-source RDBMS' advanced capabilities, core components, common commands and functions, and general DBA tasks.

AI Automation Essentials. Check out the latest Refcard on all things AI automation, including model training, data security, and more.

Related

  • Deploying a Simple Golang Web App on Heroku
  • How To Dockerize Mean Stack App
  • Using Environment Variable With Angular
  • Keep Your Application Secrets Secret

Trending

  • Running LLMs Locally: A Step-by-Step Guide
  • Enhancing Secure Software Development With ASOC Platforms
  • Test Parameterization With JUnit 5.7: A Deep Dive Into @EnumSource
  • Effective Communication Strategies Between Microservices: Techniques and Real-World Examples
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Unveiling the Truth: Is Podman Truly a Seamless Replacement for Docker?

Unveiling the Truth: Is Podman Truly a Seamless Replacement for Docker?

In this blog, you'll dive into a production-ready Dockerfile, executing Podman commands with the same finesse as you would with Docker.

By 
Pradeep Gopalgowda user avatar
Pradeep Gopalgowda
·
Jun. 12, 23 · Tutorial
Like (3)
Save
Tweet
Share
5.3K Views

Join the DZone community and get the full member experience.

Join For Free

You may have heard that Podman is a drop-in replacement for Docker, but is it truly that simple? Join us in this blog as we explore the practicality of using Podman. We'll start by working with a ready-to-go Dockerfile and run Podman commands just like you would with Docker. Let's investigate whether this transition is hassle-free!

Introducing Podman 

Podman is a container engine, much like Docker. However, it operates without a daemon and runs containers as non-root by default, which is more secure. Docker has also made strides in running as a non-root user. According to Podman's claims, all you need to do is execute the command alias docker=podman to add the alias "docker=podman," and everything will work seamlessly. But is it really that straightforward? In the rest of this blog, we'll put it to the test. We'll attempt to build a Dockerfile for a sample node application.

Installation

Installing Podman is quite easy. Just run the following command.

Shell
 
$ brew install podman-desktop


Verify the correct installation.

Shell
 
$ podman --version
podman version 4.3.1


Build Dockerfile

The first thing to do is to build the container image.

Shell
 
$ podman build -t us.icr.io/appiddemo/appid-sample:1 .
STEP 1/8: FROM node:16-alpine3.14
STEP 2/8: WORKDIR /usr/src/app
--> Using cache 25d151d2e4832bef6acac7da35dc3c3a964a9d9c51d0d81a63b7baadc3aaa1c1
--> 25d151d2e483
STEP 3/8: COPY package.json /usr/src/app
--> Using cache a4d062e20567e56de994bff1b5b03d1b6ad1cf82bd6699a8dc7a3c0abf74ec9b
--> a4d062e20567
STEP 4/8: RUN npm install --production
--> Using cache 005898b305a08421407a491e75525631b38062b18f78f9138605fe2fba81441b
--> 005898b305a0
STEP 5/8: COPY . /usr/src/app
--> Using cache 44321d8390d4987601d5a052df8ac46a97d2dc59fc4854d340065b01b791ebaf
--> 44321d8390d4
STEP 6/8: ENV PORT 80
--> Using cache 932dbd7869c70e131b6caf907cace60aa990f57df83c64bcdf44cf4e6204625a
--> 932dbd7869c7
STEP 7/8: EXPOSE 80 80
--> Using cache 3c0315133b133cb1f13af9f7e305b0252ed586dae8d999de8970a8448f71f492
--> 3c0315133b13
STEP 8/8: CMD ["npm", "start"]
--> Using cache 5c125d5b43c32d8d1bda2f0492b88dea3ef3711cdac0a7b78f9a51fd1ec2b66f
COMMIT appid-sample:1
--> 5c125d5b43c3
Successfully tagged us.icr.io/appiddemo/appid-sample:1


Let's add the alias:

Shell
 
$ alias docker=podman


Now replace podman with docker to execute the build command:

Shell
 
docker build -t us.icr.io/appiddemo/appid-sample:1 .
STEP 1/8: FROM node:16-alpine3.14
STEP 2/8: WORKDIR /usr/src/app
--> Using cache 25d151d2e4832bef6acac7da35dc3c3a964a9d9c51d0d81a63b7baadc3aaa1c1
--> 25d151d2e483
STEP 3/8: COPY package.json /usr/src/app
--> Using cache a4d062e20567e56de994bff1b5b03d1b6ad1cf82bd6699a8dc7a3c0abf74ec9b
--> a4d062e20567
STEP 4/8: RUN npm install --production
--> Using cache 005898b305a08421407a491e75525631b38062b18f78f9138605fe2fba81441b
--> 005898b305a0
STEP 5/8: COPY . /usr/src/app
--> Using cache 44321d8390d4987601d5a052df8ac46a97d2dc59fc4854d340065b01b791ebaf
--> 44321d8390d4
STEP 6/8: ENV PORT 80
--> Using cache 932dbd7869c70e131b6caf907cace60aa990f57df83c64bcdf44cf4e6204625a
--> 932dbd7869c7
STEP 7/8: EXPOSE 80 80
--> Using cache 3c0315133b133cb1f13af9f7e305b0252ed586dae8d999de8970a8448f71f492
--> 3c0315133b13
STEP 8/8: CMD ["npm", "start"]
--> Using cache 5c125d5b43c32d8d1bda2f0492b88dea3ef3711cdac0a7b78f9a51fd1ec2b66f
COMMIT appid-sample:1
--> 5c125d5b43c3
Successfully tagged us.icr.io/appiddemo/appid-sample:1


Verify the list of images with podman and docker:

Shell
 
$ podman images
REPOSITORY                        TAG            IMAGE ID      CREATED        SIZE
us.icr.io/appiddemo/appid-sample  1              5c125d5b43c3  3 days ago     232 MB
Shell
 
$ docker images
REPOSITORY                        TAG            IMAGE ID      CREATED        SIZE
us.icr.io/appiddemo/appid-sample  1              5c125d5b43c3  3 days ago     232 MB


Start Container

Now that you have built the image, it is time to start a container.

Shell
 
$ podman run us.icr.io/appiddemo/appid-sample:1

> WebSdkExample-Starter@1.0.1 start
> node app.js

[2023-06-03T23:22:17.358] [INFO] appid-sdk - Initialized
Shell
 
$ docker run us.icr.io/appiddemo/appid-sample:1

> WebSdkExample-Starter@1.0.1 start
> node app.js

[2023-06-03T23:22:17.358] [INFO] appid-sdk - Initialized



The main advantage of Podman over Docker is that it does not require a separate daemon process to run containers. With Podman, containers are managed using a client-serverless architecture, which means that containers run directly as child processes of the Podman command. This eliminates the need for a background daemon and simplifies the deployment and management of containers.

Can Podman Be Used as a Drop-in Replacement for Docker When Building a Dockerfile?

Yes, Podman is considered a drop-in replacement for Docker when it comes to building and running containers using a Dockerfile. Podman provides a compatible command-line interface with Docker, allowing you to use familiar commands and workflows.

To build a Dockerfile with Podman, you can use the build command, similar to Docker's docker build etc.

However, it's worth noting that while Podman aims to be compatible with Docker, there may still be some differences in certain advanced features and behavior between the two tools. Therefore, it's recommended to thoroughly test your applications when migrating from Docker to Podman to ensure compatibility and proper functioning.

app Build (game engine) Command (computing) Docker (software) shell Container

Published at DZone with permission of Pradeep Gopalgowda. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Deploying a Simple Golang Web App on Heroku
  • How To Dockerize Mean Stack App
  • Using Environment Variable With Angular
  • Keep Your Application Secrets Secret

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: