Member-only story
Dockerless containers with Podman on MacOS
Docker the company has been throwing wrenches lately into what used to be a smooth user experience with their new Terms of Service for Docker Desktop and various limits imposed on image pulls from DockerHub. Understandably, many people have been looking for alternatives which are easier to implement on Linux but not so much on MacOS.
We are showing here a way to build and use containers on a Mac without Docker, using Podman.
First things first, install podman via brew:
$ brew install podman
Podman only runs on Linux, so on MacOS uses a QEMU VM for the server side of the container builds. It is all spelled out here: https://www.redhat.com/sysadmin/podman-mac-machine-architecture
We need to create a Podman VM:
$ podman machine init
Downloading VM image: fedora-coreos-34.20211016.2.1-qemu.x86_64.qcow2.xz: done
Extracting compressed file
Then we start it up:
$ podman machine startINFO[0000] waiting for clients...
INFO[0000] listening tcp://0.0.0.0:7777
INFO[0000] new connection from to /var/folders/9r/1ps0_mg924sd4h3lrk1r8g040000gp/T/podman/qemu_podman-machine-default.sock
Waiting for VM ...
Machine "podman-machine-default" started successfully
From now on we can use ‘podman’ instead of ‘docker’ when running CLI commands. There is also a podman-specific way of running docker-compose.yml files. Let’s install podman-compose with pip3:
$ pip3 install https://github.com/containers/podman-compose/archive/devel.tar.gz
The podman-compose documentation mentions a fairly involved docker-compose example we can run which deploys Ansible AWX locally.
Let’s get the docker-compose.yml file via wget:
$ wget https://github.com/containers/podman-compose/blob/devel/examples/awx3/docker-compose.yml
Then in the same directory we start up the services defined in this file using podman-compose:
$ podman-compose up
<many errors>
Error: unable to start container
7d0d194e43a45639987361034d208be48a1f8cd337c85a40c19cc8616ee935ed:
error preparing container 7d0d194e43a45639987361034d208be48a1f8cd337c85a40c19cc8616ee935ed for attach:
error starting…