
Introduction to Podman: From scratch to Hello World!
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!