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:
Install the
container-tools
application stream.Install
cockpit
.Use
enable
andstart
thecockpit.socket
socket usingsystemctl
.Now we can connect to the Cockpit web console on port
9090
. Let’s log in ascloud_user
.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 port3306
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 port8080
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="enter the private IP address of host"
Now that our containers are up and running, let’s test them!
- Name the container
- 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!