Skip to content

Instantly share code, notes, and snippets.

@clouedoc
Last active April 3, 2021 08:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save clouedoc/5d6c6d5c5da5a86f8ca85a53b12da0f6 to your computer and use it in GitHub Desktop.
Installing Podman on MacOS using Vagrant (Arch Linux flavor). Last updated: april 2021

Installing Podman on MacOS

There is no standard or easy way to install Podman on your machine. So here is my flavour. I want it straightforward, easy to comprehend, and lighter than alternatives.

Introducing the Vagrant X Podman method, that I've just stolen from this blog post and modified to use Arch Linux instead.

The goal is to install an Arch Linux virtual machine using Vagrant, install podman on it, and then connect to it using podman-remote from the MacOS host.

Creating an Arch Linux podman-server guest.

note: podman-server is not an actual thing

Creating the VM

# Install Vagrant (VM manager)
brew install vagrant
# Create the directory where your Vagrantfile will be stored
mkdir archpod && cd archpod
# Create the Vagrantfile
vagrant init terrywang/archlinux
# launch the machine
vagrant up

Installing the required software in the VM

First of all, connect to the VM using vagrant ssh

Next, run the following commands:

# Update and install the prerequities
sudo pacman -Syu && sudo pacman -S podman libvarlink

# Allow ssh clients to connect and use podman
systemctl --user enable --now podman.socket
sudo loginctl enable-linger $USER

## important: restart the VM to load the updated kernel modules
shutdown -r now

# you'll need to wait about a minute before reconnecting using `vagrant ssh` again.

Check that Podman server is working

In the VM, run:

podman --remote info

Allowing connection from our MacOS host

  1. Copy your SSH pubkey in your clipboard cat ~/.ssh/id_rsa.pub | pbcopy (MacOS)
  2. Add your pubkey to the VM's authorized_keys. nano .ssh/authorized_keys (VM) then add a line and paste your key. Save and exit.

Podman-remote configuration

You need to configure the podman-remote you installed earlier to connect to your Vagrant VM. On the MacOS host:

podman system connection add arch --identity ~/.ssh/id_rsa ssh://vagrant@localhost:2222/run/user/998/podman/podman.sock

Note: your user ID might be different. Just use ls /run/user in the VM to get the correct one.

You can now check if everything is working using podman info

Try it!

podman run docker.io/library/hello-world

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment