How to add container management to Cockpit

The Cockpit web-based admin tool can be extended to include container management.

How to add container management to Cockpit

Cockpit is an admin-oriented, web-based GUI for administering Linux servers. It's available for the likes of CentOS and Ubuntu servers and makes working with those servers exponentially easier. If you happen to make use of Ubuntu server or CentOS, you can add container management into the mix. It's really quite simple and in the end, you'll have yet another means of managing your containers.

Now, before we get into this, you need to know a couple of things. First, the Cockpit container module is only available for installation on CentOS 7. Although CentOS 8 has been released, this module is yet to be released. Also, the Kubernetes Cockpit module is no more. Because of this, you are only going to be able to manage Docker containers and not a Kubernetes cluster. But for anyone developing with Docker or not needing the orchestration management of Kubernetes, this module can make your life a bit easier.

I want to walk you through the process of installing Cockpit and the Docker module on Ubuntu Server 18.04.

SEE: Hiring kit: Database administrator (TechRepublic Premium)

How to install Docker on Ubuntu Server 18.04

Before you start with Cockpit, you must first install Docker. To do this, log into your Ubuntu Server and issue the command:

sudo apt-get install

Once installed, add your user to the docker group with the command:

sudo usermod -aG docker $USER

Log out and log back in, so your user can now work with Docker.

How to install Cockpit and the Cockpit Docker module

Now we're going to install Cockpit and the Cockpit Docker module. To do this, go back to the terminal window and issue the command:

sudo apt-get install cockpit cockpit-docker -y

Once the installation completes, you are ready to log in to Cockpit.

How to access Cockpit

Open a web browser and point it to https://SERVER_IP:9090 (Where SERVER_IP is the IP address of your hosting server). You should be prompted for login credentials (Figure A).

Figure A


Logging in to Cockpit.

In order for your user to be able to function properly, you must check the box for Reuse My Password For Privileged Tasks. Once you've done that, click Log In and you'll find yourself on the main Cockpit page. On that page, you should notice the Container entry in the left navigation (Figure B).

Figure B


The container entry for Cockpit.

Click on Containers and you will see any pulled images and/or running containers (Figure C).

Figure C


The Container section of Cockpit.

To pull a new image, click Get New Image and you'll be prompted to search for the required image. These images are pulled from DockerHub, so you'll see any image that matches your search criteria. Once you've pulled some images, you can then deploy a container by clicking the run arrow associated with the image in question. This will open a popup, where you can configure the container (Figure D).

Figure D


Configuring your container.

And that's the gist of adding container management to Cockpit. Give this module a try and see if it doesn't make your container admin tasks a bit easier.

Also see


Image: Jack Wallen