Let’s have some fun with Containers on nine Managed Servers

Josua Bryner Jul 14, 2020
Let’s have some fun with Containers on nine Managed Servers

We quite often receive requests like:

  • "Do you support Docker?"
  • "How can we run Docker on our Managed Server?"
  • "Do you offer Managed Docker?"

These requests kept growing, and unfortunately, we always had to respond:

"No, sorry! It's not possible at the moment because Docker needs to be run as root. With such a service running as root, we would not be able to maintain our security standards. Containers are only possible on a nine Managed Google Kubernetes Cluster."

However, starting now(!), we now can respond with:

"HELL YEAH! WE CAN! :D"

Realistically, we should possibly respond a little more professionally. 😉

Nevertheless, now we can deliver you a fully daemonless and rootless container runtime called "Podman".

You may be thinking right now: "Wait...this isn't Docker? I wanted Docker"

And yes, you’re right! But please, sit tight, keep reading, and I will explain everything to you. What you need to know at this point is, Podman will allow you to deploy your apps more easily, test production deployments more quickly, cut deployment times dramatically, and even allow you to run services that are not (yet) available as managed services.

Sound good? Great, then let us now dive into the more exciting part!

Podman and the difference to Docker

First of all: Podman is nearly functionally identical to Docker. Both solutions are container runtimes and they are able to use the same OCI images. Hence, even the syntax is mostly the same.
The key difference is how they handle the container stack.

Let's take a step back and look at how Docker works, this will help us to understand what’s so unique about Podman.

Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers.
The Docker daemon also communicates with other daemons to manage Docker services.

This means, when you use commands such as “docker run”, the client sends these commands via API requests to dockerd (the Docker daemon), which carries them out.

 

Now let us compare to Podman and have a look at its architecture: 

 

The most significant difference is the absence of a centralized daemon. As previously mentioned, Podman is a daemonless Container Runtime, and that's the really cool part about it!

First (and this one is huge!), containers can be run by any user, with or without root privileges.

Second, no more centralized daemon process. Each container spawns its own child processes and handles the requests by itself (this is called a fork/execution model).

This architecture leads to a much more robust and secure container runtime.

 

 

On Docker, if one container has a problem that affects the centralized daemon, it could affect all other containers as well. On Podman, this can not happen.

Furthermore, running a container as root can be a serious security risk.

Depending on the image and services used, some design issues could possibly be exploited to “escape” a container and gain root privileges on the host system. Given this, it is best practice to run all containers as a non-root user.

There is one more big advantage for Podman over Docker: Podman can run containers like Docker but can also run Pods as you find on Kubernetes (Hence, the name “Podman”).

A Pod encapsulates an application's container (or, in some cases, multiple containers), including storage resources, a unique network identity (IP address), as well as options that control how the container(s) should run.

As an example, take the diagram to the right:

Here we have a Pod that contains two containers and one volume. One container runs a web server while the other container operates a file puller application. 

The file puller extracts some files from the content manager and stores them in the shared volume. The web server accesses the files from the shared volume and delivers the files to the consumer.

Despite the three distinct internal objects, from an external point-of-view this is seen as just one entity as everything runs in the same namespace and has, therefore, only one external IP.   

Source: https://kubernetes.io/docs/concepts/workloads/pods/pod-overview

When should I use Podman?

At this point, some of you may ask: "So… is this the perfect solution for everything or are there any downsides?"

Well, if you want to deploy a more complex infrastructure with high availability and great scalability, then you should consider using our Managed GKE (Google Kubernetes Engine): https://www.nine.ch/en/products/gke

However, for many use cases, this solution is perfect! Let’s look at a few examples:

  • Are your deployments of a new version always painful, requiring a lot of time, often with a long downtime as well?  
Well, then it's time to run your application in a container. Simply create an image with all the needed dependencies and spin up your application in this container. When a new version is ready to deploy, just respawn the container with the new version inside it.

  • Perhaps you want to set up a new Website with as little hassle as possible. Ideally, this would be an out-of-the-box solution that just works.
Why not try the famous Ghost CMS or Wordpress? There are some nice container images which provide you with all the necessary dependencies and a basic configuration. All you need to do is start a container from this image and you’re good to go.

  • Maybe you are already using Docker locally on your machine to test and develop your new application, and now you want to deploy it in your production environment.
Wouldn’t it be convenient to run it the same way on your server as you already do on your local machine? This way, you have the same versions of all your dependencies everywhere, and you can be sure that everything works as expected. With Podman on your server, you can absolutely do this with minimal effort.

  • Do you still have an old application that requires PHP 5? Podman covers you there too!

Take an image that has the needed PHP version included, or create one yourself, and deploy your application inside the container.

Bonus: Using this method you can reduce the security risk of using an obsolete version because the old PHP version is sealed away from your host system.

Of course, sometimes there are still a few configurations needed here and there to be able to run your application in a container. But for a lot of mainstream applications, there are ready-to-use images already available.

  • Perhaps you are planning to migrate your application to our nine Managed GKE service? Most likely, your application will require some tweaking and refactoring to be able to run perfectly on GKE.
Good news! Podman fits perfectly for this case, it allows you to prepare your applications for a smooth move to GKE. It even uses the same Kubernetes YAML files.

The possibilities with Podman are endless and will help you in many ways.
You will 💙it! 

Why are solutions like Podman only available now?

Containers and Security are a complex topic.

The demand for a rootless container runtime from the community has been growing steadily.

Docker has been adapted to be run as a non-root user, however, it was not designed for this scenario and therefore reduces the usability and functionality. Even then, there are still some security issues left, and as such, this wasn’t a solution we wanted to endorse as a managed service.

Today, many different container runtimes are available, including CRI-O, LXC, rtk and containerd, to name a few of the most popular ones. As you may have noticed, none of these solutions have emerged as the clear leader. Some of them can run rootless, but the extensive functionality or convenience of this easy-to-use design, as Docker provides, has not yet been achieved by any of it.

In mid-2017, a new competitor appeared in the arena - Podman:

Podman wanted to solve the fundamental architecture problems of Docker while offering the same functionalities. Already back then, it seemed to be an interesting concept with great potential. 

This concept was proven correct over the ensuing years, and with the latest releases, Podman is now solidly established in terms of security, functionality, and stability. As a result of this maturity, we are now able to provide you Podman as one of our managed services.

On a side note: Red Hat heavily supports the Podman project. The company released Podman in RHEL 7.6 and even dropped Docker support completely starting with RHEL 8.

Get started

Did we spark your interest? Then let’s start having some fun with containers!

Our new Managed Simple Service “Podman” is available for all managed servers with Ubuntu 18.04 or newer for currently CHF 30.- per month.

Podman can be installed on your system in no-time, simply write us a support ticket and we will get you “containerized”!

If you’d like, you can already have a sneak peek at it with our step-by-step guide for setting up a Ghost CMS in a Podman Pod: https://support.nine.ch/a/4a1j_NF4fOQ

We’ll provide some additional examples of use cases and how to implement them with Podman in the coming weeks.

And as always, if you have any questions about our products, just let us know. We’re happy to help!

Contact nine now