Podman - Alternative to Docker Desktop
Last month, Docker had extended the product subscription model to Docker Desktop. According to Docker Blog, Docker desktop will remain free for personal use, educational and non-commercial opensource project. However Docker Desktop for commercial use has been classified into Docker Pro, Docker Team, and Docker Business.
The existing Docker desktop has been renamed as Docker Personal effective August 31st 2021 and there is a grace period till 31st January 2022 for those requires paid subscription. This implies PoC and use-case research using container based setup at our workplace requires an alternative.
Since most of us use windows OS at our workplace, Docker Desktop was the de-facto platform to run containers. With the subscription model, many would look towards alternatives to use.
Podman is one such alternative to Docker desktop which is open-source, Linux-native container engine which can be used to build, run and manage OCI containers and images. Podman command-line interface(CLI) is similar to Docker but it operates differently. Docker basically have two components named client and Deamon. CLI issued on Docker will be sent from Docker client to Deamon(dockerd) which is self-sufficient runtime manages the objects. However Podman is daemonless which starts containers as child processes and it interacts directly with the registry.
How to install Podman
Although there is no installation of podman available for windows, We have to use WSL as the platform to run podman. However there is remote client available which you can install to access remote client.
Pre-requisite
Since there is no direct installation available on Ubuntu, you may have to configure podman repository source and configure it. Follow the below steps to install and configure the podman.
Install the dependencies
sudo apt-get install curl wget gnupg2 -y
Install the Podman Repository
source /etc/os-release
sudo sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
Download and configure gpg key
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O- | sudo apt-key add -
Install Podman
sudo apt-get update
sudo apt-get install podman -y
Verify the installation
podman version
podman info
Aliasing Podman to Docker
We are all habituated to docker command and its quite easy to use the docker command rather than learning the CLI of another container engine. Although podman uses the similar cli arguments where it can be easily aliased.
领英推荐
On WSL ubuntu, you may run below command and continue to use the docker command which will be executed by podman.
alias docker=podman
Running Podman from remote
It is possible t run the podman remotely from windows workstation. You may follow the documentation to connect to remote server(including WSL) via SSH and execute all docker/podman commands.
On windows workstation you may run below commands to config alias if you have configured to connect to remote podman
doskey docker=podman #In command prompt
Set-Alias -Name docker -Value podman # in powershell prompt
Accessing the applications running on containers
Since WSL also does port mapping from Linux to windows, it is possible to access the application ran on container over the windows workstation without any issue.
Note: Port number below 1024 is not permitted by default on WSL. However it can be configured if required.
Here is the example of building and running docker image based on docker sample Linux tweet app
Docker-compose on Podman
Install the CLI using below command and add a alias.
sudo curl -o /usr/local/bin/podman-compose https://raw.githubusercontent.com/containers/podman-compose/devel/podman_compose.py
sudo chmod +x /usr/local/bin/podman-compose
Create an alias with command alias docker-compose=podman-compose and start running the compose file to test build and run the applications
Conclusion
Although docker installation on Linux distro will be free, it is still possible to continue to use the docker tools to run containers on windows workstation using WSL. Also Docker blog has detailed article on why docker desktop is better for windows or Mac machines. However if you are looking for an alternative container engine, Podman is the apt choice as there is no/less learning curve and it is backed by Redhat and Open source community.
Head of Engineering @ LV= | Azure, AWS - DataOps/DevOps/MLOps, Cross-functional Team Leadership
3 年This is very amazing and informative … Thanks Naveen for sharing this … it’s brilliant ????