Introduction to Podman: From scratch to Hello World!

Marcelo Schirbel Gomes
2 min readFeb 27, 2019

Hi guys!

I’m back! How are you? I hope you are all doing fine!

Today, I’m here to show you an alternative to Docker. Are you tired of Docker? No? Me neither! But hey, we now got multiple ways to go! Isn't that amazing?

First of all, what are we going to need?

Just a regular CentOS server. If you do not know how to set up a brutal home lab check out here.

OK, boot up your VM, and let’s roll!

If you followed my instructions, you will log in as vagrant. Not a root user.

You could set up a new user for this tutorial.

One thing that differs Podman to Docker is not having a daemon running behind the container layer. This makes our lives much easier!

To install Podman run it:

sudo yum install -y podman

That easy!

After you run this you may check if your Podman is working:

sudo podman ps

OK, so Podman is working. How about running some containers?

sudo podman run hello-world

And now things get a little interesting. As you can see Podman downloaded this image from DockerHub. Wait, what?

Yes, Podman can read DockerHub for images, may they be private or public.

If you want to check your images:

sudo podman image ls -a

You could see your containers:

sudo podman ps -a

And remove containers:

sudo podman rm d86089bc90b3

And remove images:

sudo podman image rm fce289e99eb9

OK, thats great. But.. how do I code into this?
Well, my friend… use a Dockerfile!
Here, take one:

FROM centos:latest
RUN yum -y install httpd
CMD [“/usr/sbin/httpd”, “-D”, “FOREGROUND”]
EXPOSE 80

It’s a simple HTTPD Web Server hosted on a CentOS machine.
Now build it!

sudo podman build .

List your images and run it!

sudo podman run -dit -p 80:80 

Now curl it to get HTTP 200 OK

curl -I http://localhost:80


With Podman you could do almost everything Docker does, except for Docker Swarm. Still a great tool to know!
Hope you enjoyed it!
See ya!

Sign up to discover human stories that deepen your understanding of the world.

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

Marcelo Schirbel Gomes
Marcelo Schirbel Gomes

Written by Marcelo Schirbel Gomes

This is just a bit of my life. Writing another line everyday!

Responses (3)

Write a response

sudo podman ps

Podman runs in user-space, which is one of its advantages over Dokcer, as such sudo is not required!

This has nothing to do with containers from "scratch". The title is misleading at best. OCI compliant containers are why podman exists as well as the slow iteration cycles that docker has encountered in the last few cycles. The title would be more appropriately named "Using Podman to build containers from Dockerfiles"

FROM centos:latest
RUN yum -y install httpd
ENTRYPOINT [“/usr/sbin/httpd”, “-D”, “FOREGROUND”]
EXPOSE 80
Correct working Dockerfile