DEV Community

Cover image for Podman/Buildah toolchain in Ubuntu
Juan Julián Merelo Guervós
Juan Julián Merelo Guervós

Posted on

Podman/Buildah toolchain in Ubuntu

Fortunately, and thanks to the Open Containers Initiative, there's now an alternative to Docker created by RedHat: Buildah is a tool for creating containers, while Podman runs the containers. All of them, in userspace.

That's the catch, however. It needs some other tools to build and run stuff. Let's use them, for instance, to build and run this minimal Alpine dockerfile
But you can install all of them in easy steps in Ubuntu:

  1. Install Buildah. Just add the corresponding repo and download it:
sudo apt-get update -qq
sudo apt-get install -qq -y software-properties-common
sudo add-apt-repository -y ppa:projectatomic/ppa
sudo apt-get update -qq
sudo apt-get -qq -y install buildah
Enter fullscreen mode Exit fullscreen mode
  1. You need to install runc to actually use the command RUN inside the Dockerfile. That pretty straighforward: sudo apt-get install runc. The catch with this is that it uninstalls docker-ce, so you're left without your good old docker. If you are not comfortable with this, just skip the installation of Buildah or use it only for images that don't need to use RUN

  2. You're good to go now building the container. bud is the equivalent here of build in good old docker CLI:

buildah bud -f alpine/Dockerfile -t your-name-here/alpine-hola-mundo
Enter fullscreen mode Exit fullscreen mode

You can use any container, that's the command if you downloaded the repo above

  1. Let's go and run it. We need to install slirp4netns, a tool for user-mode networking. Next step will work without this, but you'll get a nasty error (and might fail when actual networking is used):
sudo apt install slirp4netns
Enter fullscreen mode Exit fullscreen mode
  1. Installing podman is a breeze, with all the repos added and everything
sudo apt install podman
Enter fullscreen mode Exit fullscreen mode
  1. Ready to run!
podman run -t your-name-here/alpine-hola-mundo
Enter fullscreen mode Exit fullscreen mode

It's a nice alternative just because it's an alternative, and then because you don't actually need to run a daemon to run containers, so your sysop might be better sold with this.

Update: I tried it on another machine, and it just didn't work, even with the same operating system. Might be this toolchain still has some issues. I posted them where they correspond, I'll update when they are solved.

Top comments (3)

Collapse
 
viveksatpute profile image
VivekSatpute • Edited

Thanks a much for this blog. But may I know on which Ubuntu version this works? I tried on Ubuntu 20.04 and Ubuntu 16.04 but it failing with below errors:
ON Ubuntu 16.04:

After podman installation, podman cli throws below error.
root@c9442a8f1499:/# podman ps
ERRO[0000] 'overlay' is not supported over overlayfs

Error: error creating libpod runtime: 'overlay' is not supported over overlayfs: backing file system is unsupported for this graph driver

ON Ubuntu 20.04:

Podman installtion itself fails with error -
root@72f96f3706b6:/# add-apt-repository -y ppa:projectatomic/ppa
Hit:1 security.ubuntu.com/ubuntu focal-security InRelease
Ign:2 ppa.launchpad.net/projectatomic/pp... focal InRelease
Hit:3 archive.ubuntu.com/ubuntu focal InRelease
Hit:4 archive.ubuntu.com/ubuntu focal-updates InRelease

Err:5 ppa.launchpad.net/projectatomic/pp... focal Release
404 Not Found [IP: 91.189.95.83 80]
Hit:6 archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
E: The repository 'ppa.launchpad.net/projectatomic/pp... focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
root@72f96f3706b6:/#

Collapse
 
jj profile image
Juan Julián Merelo Guervós

It probably does not work in the first version, and not supported yet in the newest version. It's probably better if you check out the updated instructions, shown in the next comment.

Collapse
 
alitvak69 profile image
alitvak69

Here is the new information.

podman.io/getting-started/installa...