DEV Community

Cover image for Transitioning from Docker to Podman: Navigating Challenges and Practical Solutions
Pedro Caldeira
Pedro Caldeira

Posted on

Transitioning from Docker to Podman: Navigating Challenges and Practical Solutions

Introduction

Containers in software development encapsulate applications with dependencies, offering portability and consistency across computing environments. Docker and Podman, prominent containerization platforms, provide distinct features.

Docker Overview

Widely adopted, Docker simplifies application creation, deployment, and management with a client-server architecture, CLI, and graphical interface. Seamless image sharing contributes to its popularity among developers and operations teams.

Podman Overview

Podman, a popular alternative tool, distinguishes itself with a daemonless architecture. Operating without a central background process, it offers a CLI similar to Docker, prioritizing security and simplicity.

Both Docker and Podman adhere to OCI standards, revolutionizing software development practices.

Context

Docker's subscription-based pricing for enterprise services contrasts with Podman's open-source model, making it cost-effective for organizations. This distinction is crucial for smaller businesses seeking functionality without hefty costs. Podman's lack of a daemon adds to its appeal, providing a simpler and potentially more resource-efficient alternative for users favoring a daemonless approach to container management.

Exploring Podman

Aliasing for Seamless Transition

My initial step involved creating an alias from "docker" to "podman" and incorporating it into my .bashrc. This way, I can continue using the familiar "docker" command while the underlying implementation is Podman.

alias docker=podman

$ docker --version
podman version 4.4.1
Enter fullscreen mode Exit fullscreen mode

This aliasing approach is particularly handy when dealing with legacy scripts already set up for Docker, eliminating the need for immediate replacements.

Daemonless Operation

Podman's standout feature, its daemonless architecture, may pose challenges for libraries and applications previously integrated with Docker and its daemon. In a Python script example utilizing the "docker" module, attempting to initialize it resulted in the following error:

Unable to initialize Docker client. Check that the Docker daemon is running and try again. Exception received from docker.from_env() command: Error while fetching server API version: ('Connection aborted.', PermissionError(13, 'Permission denied'))

To resolve this issue:

  1. Identify your Podman socket:
   podman info --format '{{.Host.RemoteSocket.Path}}'
Enter fullscreen mode Exit fullscreen mode
  1. Set DOCKER_HOST as your Podman socket obtained in step 1.
   $ export DOCKER_HOST=unix://<your_podman_socket_location>
Enter fullscreen mode Exit fullscreen mode

Optional: Consider adding this variable to your .bashrc for convenience.

Addressing Permission Denied Issues

Podman usage may encounter various issues, including permission-denied errors. For an exhaustive list of potential problems, refer to this resource.

In my experience, a Docker image that functioned well with Docker faced permission-denied errors with Podman. Even running with sudo did not resolve the issue.

I discovered that Podman, by default, restricts Linux capabilities in its containers, leading to permission errors. To overcome this:

Add --cap-add all to your script:

podman run --cap-add all <your_image>
Enter fullscreen mode Exit fullscreen mode

While this isn't a permanent solution, it served my one-time use case. For a more robust approach, identify the necessary capabilities and replace the "all" argument accordingly. However, this provided a quick and effective resolution for a single-use scenario.

Conclusion

In summary, Podman presents itself as a more resourceful option than Docker, with notable strengths in security and flexibility. However, potential challenges and disruptions in transitioning should be considered, especially for projects already established on Docker. Whether the move to Podman is worth depends on your project's specific needs and requirements. If the enhanced features and resource efficiency align with your objectives, navigating the transition complexities may prove beneficial; otherwise, sticking with Docker might be the more pragmatic choice for your current setup.

Top comments (5)

Collapse
 
kehoecj profile image
Clayton Kehoe

Nice guide!

Collapse
 
david_j_eddy profile image
David J Eddy

I myself have migrated fully away from Docker. Having been am early adopter of Docker it has been sad to watching the direction the business has chose. After doing so much good to bring the technology to the masses in an understate and useful way, the business now treats its community as a revenue source.

Podman keeps the hope alive.

Collapse
 
ygorbunkov profile image
ygorbunkov

Given CentOS story it is not entirely clear what you base your hopes upon.

Collapse
 
ygorbunkov profile image
ygorbunkov

Docker Engine Community Edition is completely free for personal and commercial use. Furthermore, Podman lacks certain features like Swarm or AppArmour support so it can't be considered a drop-in replacement of Docker.

Collapse
 
khuongduybui profile image
Duy K. Bui

What I am looking for is a viable migration path for docker compose. So far I have not found anything.