Manage Podman Containers Using Cockpit on RHEL

45 minutes
  • 4 Learning Objectives

About this Hands-on Lab

Cockpit is an easy-to-use, web-based system management tool for Linux servers that can manage Podman containers with the cockpit-podman plugin. In this lab, we will install Cockpit and the cockpit-podman plugin and will use Cockpit to manage Podman containers. Upon completion of this lab, you will be able to configure a Cockpit installation and use it to manage your Podman containers.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install Cockpit and the ‘container-tools’ Module

Perform the following:

  1. Install the container-tools application stream.

  2. Install cockpit.

  3. Use enable and start the cockpit.socket socket using systemctl.

  4. Now we can connect to the Cockpit web console on port 9090. Let’s log in as cloud_user.

  5. You’ll notice that we get a message that the "Podman service is not active." Let’s start it.

Now that we’re good to go, we see that we have no containers or images. Let’s change that!

Use Cockpit to Download Container Images

Connect to the Cockpit web console. Let’s log in as cloud_user.

Let’s take a look at the tab for the Podman containers plugin.

You’ll notice that we get a message that the "Podman service is not active." Let’s start it.

First, let’s grab some images. We’ll grab the following:

  • wordpress (from docker.io/library/wordpress)
  • mariadb (from docker.io/library/mariadb)

Let’s use our images to start some containers!

Start a WordPress Container Instance Using Cockpit

We’re going to start a WordPress installation, using two containers:

Start a mariadb container:

  • Name the container wp-db.
  • Publish port 3306 in the container to port 3306 on the host.
  • Use the mariadb container image.
  • Set the following variables:
    • MYSQL_ROOT_PASSWORD="dbpass"
    • MYSQL_DATABASE="wp"
    • MYSQL_USER="wordpress"
    • MYSQL_PASSWORD="wppass"

Start a WordPress container:

  • Name the container wp-web.
  • Publish port 80 in the container to port 8080 on the host.
  • Use the wordpress container image.
  • Set the following variables:
    • WORDPRESS_DB_NAME="wp"
    • WORDPRESS_DB_USER="wordpress"
    • WORDPRESS_DB_PASSWORD="wppass"
    • WORDPRESS_DB_HOST="[private IP address of host]"

Now that our containers are up and running, let’s test them!

Test Our WordPress Installation and Clean Up!

Let’s try connecting to our WordPress installation using the external DNS or IP address of our server and port 8080.

You should get the WordPress setup page. When you’re done testing, clean up all the containers and images.

Great work, Cloud Guru! You stood up a WordPress instance using Cockpit and the Podman plugin!

Additional Resources

Self-serve it is!

Our team of web developers have been enjoying their WordPress container instances, but they'd like to be able to self-manage their instances using a web browser. We're going to test a method we've developed just for this, using Cockpit and the cockpit-podman plugin.

Let's give it a try!

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!