If you’re a Red Hat Enterprise Linux or CentOS user, chances are you’ve heard of Cockpit, a powerful web-based GUI that allows you to manage a number of tasks on your servers. With this tool, you can:
- Get an at-a-glance look at system performance
- View logs
- Manage system storage
- Enable/Disable the firewall
- Configure networking
- Create/manage user accounts
- Stop/start services
- View SSH sessions
- View diagnostic reports and kernel dumps
- Manage SELinux
- Update software
- Access the terminal
That’s all out of the box. You can also add other features to the system, such as container support. Understand, if you’re working with RHEL/CentOS 8, you’ll be adding podman support. If, on the other hand, you’re using an older release (such as CentOS 7), you can still add Docker support.
I’m going to walk you through the process of adding podman container support to the Cockpit system. Once you’ve done that, you’ll be able to download images and deploy containers. For anyone who’d prefer a handy GUI tool for this task, Cockpit is, by far, the easiest to get up and running. And considering you can do other admin tasks within this one tool, it makes perfect sense to add containers into the mix.
Let’s make this happen.
What You’ll Need
The only things you’ll need to add container support to Cockpit are:
- A running instance of Cockpit (either on CentOS or RHEL).
- A user with sudo privileges.
That’s it. Let’s make some magic. I’ll demonstrate on a freshly updated instance of CentOS 8.
Prior to CentOS 8, you had to install Cockpit. With CentOS 8, on the other hand, it’s installed out of the box. Even though the software is installed, it’s not enabled. So the first thing to be done is to enable Cockpit.
Log into your CentOS or RHEL server. If the server has a desktop environment, open a terminal window. From the terminal, issue the command:
sudo systemctl enable --now cockpit.socket
When prompted, type your sudo password and hit Enter. After that command completes, Cockpit is enabled and ready to go.
Before we continue on, let’s make sure you can access Cockpit. Point a web browser to: https://SERVER_IP:9090 (where SERVER_IP is the IP address of the hosting server). You should be greeted by the Cockpit login (Figure 1).
Log in with the root user’s credentials, making sure to check the box for Reuse my password for privileged tasks. Why? Because at the moment, Podman isn’t capable of running rootless containers, so you’ll need that heightened privilege to work with Podman.
However, we’ve not added Podman support yet. So let’s add it. Log out of Cockpit and head back to the terminal window.
Adding Podman Support
In order to add Podman support, you’ll need to install another application. At the terminal window, issue the following command:
sudo dnf install cockpit-podman -y
Once that command completes, log back into Cockpit (with root’s credentials) and you should see Podman Containers listed in the left sidebar (Figure 2).
Click Podman Containers in the left navigation and you’ll see a warning that the service isn’t running (Figure 3).
Make sure the checkbox for Automatically start podman on boot is checked, and then click Start podman.
You should now see the Podman Containers Cockpit dashboard (Figure 4).
Working with Podman Containers
Unless you’ve already used the podman command line, you won’t have any images or containers listed in the dashboard. Let’s fix that.
To download a new image, click Get new image. In the resulting pop-up (Figure 5), type the name of the image you want to download and wait for the results.
Once the results have appeared (Figure 6), select the image you want and click Download.
There’s one caveat you’ll experience on CentOS. Unless you’re a subscriber to RHEL, you won’t be able to download images from the Red Hat repositories. That’s okay, because if you scroll down, you’ll find images from other sources.
After the image downloads, you’ll see it listed in the Dashboard. Click the run button (right-pointing arrow) associated with the image and you can then configure a container to be deployed in the resulting popup window (Figure 7).
Your deployed container will now be listed in the Podman Dashboard (Figure 8).
And that’s all there is to adding container support to the Cockpit web-based GUI. Although you might not work all of your container magic within the confines of this tool, it can make the management of your containers and images significantly easier.
Red Hat is a sponsor of The New Stack.
The New Stack is a wholly owned subsidiary of Insight Partners, an investor in the following companies mentioned in this article: Docker.