Getting started with Podman on Mac

Swapnasagar Pradhan
5 min readDec 25, 2019

--

There is no doubt that Docker made containers popularity and adoption to explode , but it doesn’t mean it’s the best technology for working with.

As a developer, you start relying on standards and on a number of companies not to screw developing and supporting of these standards up, then you are free to choose your tools for local development.

At the end we all are working with the same API , then we don’t have to lock-in into a specific tool. Why not Docker ? Is this because we don’t have to use docker anymore, then what will be the replacement for it ?

Let find out :

Introducing PODMAN aka pod-manager

Podman is tool for managing POD/Containers based on the Docker CLI

  • # podman ps -a
  • # podman run -ti fedora sleep 2000
  • # podman exec -ti fedora sh
  • # podman images

I will not go deep about it but to aware: it does not implement a daemon like the Docker Engine and Podman is more of a traditional fork/exec model of Unix and Linux and it’s developed by REDHAT team.

More over we are going to see how to get up and running with Podman in MacOS

To get it installed you can just run this and you can take podman for a swrill :)

brew cask install podman

Once it’s installed you can verify :

podman — version

podman version 1.6.1-dev

ATM there is no immediate support for Mac to run rootless containers , Instead, you would have to run podman on a linux-based system and connect to it and we will see that how :

I need to admit that docker did a fav job to streamline and socialise containerisation. Otherwise people will go over their own loveable things concluding to on their own, look at the VM revolution , it ended up in somewhere. But docker showed the world how to get it done.

….ok , the reason I mentioned about it , it created cool tool set like boot2docker and docker-machine which is later converted to docker desktop and people are following it’s path.

To run this we need to make use of boot2podman or Podman-machine

More info- https://github.com/boot2podman/machine

Podman Machine

Image source : https://github.com/boot2podman/machine

Machine lets you create Podman hosts on your computer. It creates servers with Podman on them, then configures the Podman client to talk to them.

Download binaries for MacOSX can be found at: podman-machine.darwin-amd64

Download it and put it in your path, adding executable permissions if needed.

Darwin (OS X)

mv podman-machine.darwin-amd64 /usr/local/bin/podman-machine

chmod +x podman-machine

podman-machine — version

podman-machine version dev, build 16aed9e

Download Virtual box for MacOSX and install — https://download.virtualbox.org/virtualbox/6.1.0/VirtualBox-6.1.0-135406-OSX.dmg

Podman-machine uses — boot2podman.iso which can be found at — https://github.com/boot2podman/boot2podman/releases/latest/download/boot2podman.iso

Boot2podman is a lightweight Linux distribution made specifically to run Linux containers. It runs completely from RAM.

Getting started

podman-machine create box
podman-machine env box

Confirm which version running on the linux box

swapnasagar$ podman-machine ssh box — sudo podman version

Version: 1.6.0-dev

RemoteAPI Version: 1

Go Version: go1.12.10

OS/Arch: linux/amd64

From the above we confirm that our box is ready and podman is running as well , now we need to connect it remotely and perform the same operation

swapnasagar$ podman-machine env box — varlink

export PODMAN_VARLINK_BRIDGE=”/usr/bin/ssh -F /dev/null -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none -o LogLevel=quiet -o PasswordAuthentication=no -o ServerAliveInterval=60 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@127.0.0.1 -o IdentitiesOnly=yes -i /Users/swapnasagar/.local/machine/machines/box/id_rsa -p 51073 varlink bridge”

export PODMAN_MACHINE_NAME=”box”

# Run this command to configure your shell:

# eval $(podman-machine env box — varlink)

After running all the mentioned command we are ready for the tests.

Download Podman-remote-darwin — https://github.com/boot2podman/libpod/releases/download/v1.6.1/podman-remote-darwin

And I have renamed the Podman bins accordingly and you can name them as per your like.

swapnasagar$ mv podman podman.1 # renamed the original podman binary

swapnasagar$ mv podman-remote-darwin podman # renamed remote podman to podman

I tried to run a container but it failed and it looks like it was expecting a environment variable and it seems the work is in progress.

swapnasagar$ podman run -it busybox

Error: client must use upgraded connection to attach

https://github.com/containers/libpod/issues/4156

So as a workaround mentioned on the project

starting a ssh command, as a background process

swapnasagar$ podman-machine ssh box -L 8080:localhost:8080 -N &

[1] 53490

swapnasagar$ podman-machine ssh box — sudo podman run -d -p 8080:80 nginx

fe18856c1ff8fdf26bf346ed9eea072b56c11d0239929a9067b9960b30f9f3be

swapnasagar$ podman ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

fe18856c1ff8 docker.io/library/nginx:latest nginx -g daemon o… 5 seconds ago Up 5 seconds ago 0.0.0.0:8080->80/tcp hopeful_mclaren

From the above exercise, i can confirm that how i am thankful towards docker and indeed it made our life easy , but due to recent change in direction , it going to provide apps for k8’s endpoint which I see as a soul missing out.

Any ways Docker Folks — I just wanna say you big thanks for developing such a technology.

Am going to write some more part about it on RHEL to conclude the series and …..

Referrals: https://github.com/containers/libpod

https://podman.io/

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Swapnasagar Pradhan
Swapnasagar Pradhan

Written by Swapnasagar Pradhan

Husband | Father |Engineer | Sysadmin by choice | Ops by trade | love with NFT

Responses (1)

Write a response