Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Resources to explore

Check out popular resources, tools, and information from Red Hat. We'll recommend more as you browse.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Cockpit: Your entrypoint to the Containers Management World

November 15, 2016
Alessandro Arrichiello
Related topics:
ContainersLinux
Related products:
Red Hat Enterprise Linux

    Containers are one of the top trend today. Starting working or playing with them could be really hard also if you've well understood the theory at their base.

    With this article I'll try to show you some useful tips and tricks to start into containers world, thanks also to the great web interface provided by the Cockpit project.

    cockpit--capture-15-cockpit-project-http___cockpit-project-org_

    Cockpit overview

    Cockpit is an interactive server admin interface.  You'll find below some a of its great features:

    • Cockpit comes “out of the box” ready for the admin to interact with the system immediately, without installing stuff, configuring access controls, making choices, etc.
    • Cockpit has (as near as makes no difference) zero memory and process footprint on the server when not in use. The job of a server is not to show a pretty UI to admins, but to serve stuff to others. Cockpit starts on demand via socket activation and exits when not in use.
    • Cockpit does not take over your server in such a way that you can then only perform further configuration in Cockpit.
    • Cockpit itself does not have a predefined template or state for the server that it then imposes on the server. It is imperative configuration rather than declarative configuration.
    • Cockpit dynamically updates itself to reflect the current state of the server, within a time frame of a few seconds.
    • Cockpit is firewall friendly: it opens one port for browser connections: by default that is 9090.
    • Cockpit can look different on different operating systems, because it’s the UI for the OS, and not a external tool.
    • Cockpit is pluggable: it allows others to add additional UI pieces.

    Cockpit docker

    Cockpit can manage containers via docker. This functionality is present in the Cockpit docker package.

    Cockpit communicates with docker via its API via the /var/run/docker.sock unix socket. The docker API is root equivalent, and on a properly configured system, only root can access the docker API. If the currently logged in user is not root then Cockpit will try to escalate the user's privileges via Polkit or sudo before connecting to the socket.

    Alternatively you may create a docker unix group. Anyone in that docker group can then access the docker API, and gain root privileges on the system.

    Cockpit version

    Cockpit project is highly under development, to follow this how-to without incurring in to issue I suggest you to start at least from version 0.117. Starting from this version, it was introduced docker-storage feature. You'll find this version from Fedora 24 and RHEL 7.3.

    Cockpit Installation

    You've two methods for running cockpit on your system:

    1. Standard installation through package manager
    2. Containerized version (for Atomic Host)

    I know, this may sound weird: a running container that actually manage other containers. But it works well!

    Prerequisites

    Following this how-to requires you to have a working docker daemon running on your system.

    Cockpit Installation via Package Manager

    The installation is quite simple, as any other standard package.

    On Fedora you can install it via dnf:

    # dnf install cockpit cockpit-docker

    On RHEL7 via yum:

    # subscription-manager repos --enable rhel-7-server-extras-rpms
    # yum install cockpit cockpit-docker

    After that you can easily enable and start the cockpit service:

    # systemctl enable cockpit.service
    # systemctl start cockpit.service
    

    Cockpit Container on Atomic Host

    Cockpit container for docker is available through the standard docker's distribution channel: DockerHub.

    Supposing you've already configured (as required in prerequisite section) docker, you can pull and run a Cockpit containerized daemon via:

    # atomic run docker.io/cockpit/ws

    In case you're on Red Hat Atomic Host system, you can use the container provided by Red Hat Registry: "rhel7/cockpit-ws":

    # atomic run registry.access.redhat.com/rhel7/cockpit-ws

     

    Cockpit First Login and Containers plugin

    Once started, Cockpit Web Service listens by default on the host port 9090. Browse to address https://server_ip:9090

    Please note: In the next steps I'll proceed using a Red Hat Enterprise Linux 7.3 system.

    You can find below the login page, you can easily access it with any available user in the host:

    cockpit-1-rhel73test-local-https___192-168-121-43_9090_

    I'll proceed with root login, but as I wrote before you'll be able any other user with the right privileges for interacting with docker.

    cockpit-capture-2-system-192-168-121-43-https___192-168-121-43_9090_system

    As you can see, the welcome page reports various performance infos on the running system.

    Without entering in details of all the many Cockpit's features, just click on "Containers" link on the left bar.

    cockpit-capture-4-containers-192-168-121-43-https___192-168-121-43_9090_docker

    The Containers page shows an overview of the current docker's state.

    You have in this page all the features you need for managing your containers: managing docker formatted images and containers. In the next section I'll show you a real use case example.

     

    WordPress Example Deployment

    In this section I'll show you how to manage a WordPress deployment with two containers:

    • Web server -> wordpress:latest
    • MariaDB server -> mariadb:latest

    First of all we need to get these two docker formatted images. We can search for them through the "Get new image" button and submitting keywords: "wordpress" first and "mariadb" then.

    cockpit-capture-7-containers-192-168-121-43-https___192-168-121-43_9090_docker

    At end of downloads you'll find the list of images under the respective frame:

    cockpit-capture-8-containers-192-168-121-43-https___192-168-121-43_9090_docker

    We're ready to launch them, anyway we need one further step before: creating persistent volumes to attach at running containers.

    Access to the running system and create two folder under /mnt/pv:

    # mkdir -p /mnt/pv/wordpress
    # mkdir -p /mnt/pv/mariadb

    Now click on the "Play" button on the mariadb's docker image row and start filling the form's required field.

    cockpit-capture-10-containers-192-168-121-43-https___192-168-121-43_9090_docker

    • Uncheck the "Expose container ports" checkbox (we don't need to expose mariadb port, this container should be connected only to the webserver)
    • Add another value/row under the default volume's row (leaving the first as-is): "/var/lib/mysql:Z" -> "/mnt/pv/mariadb"
      • We need to create a new value/raw because we need to inform docker that we're using SELinux and we want it set the right SELinux context just before attaching the volume to the container (this is why we've added ":Z" to the "mysql" path)
      • In case you've disabled SELinux you can skip the second value/row adding
    • Add all the required container's environment variables:
      • MYSQL_ROOT_PASSWORD
      • MYSQL_DATABASE
      • MYSQL_USER
      • MYSQL_PASSWORD
    • Restart policy: always

    At the end we'll see a row under the Running Containers frame, after clicking on it, we'll see a detailed overview of the running container:

    cockpit-capture-11-containers-192-168-121-43_-https___192-168-121-43_9090_docker

    We can now proceed running the second container: wordpress. Press the "Play" button and start compiling the form requested values.

    cockpit-capture-12-containers-192-168-121-43-https___192-168-121-43_9090_docker

    • Check the "Link to another container" checkbox, select the name of the mariadb container and give it an alias ("mariadb" for example)
    • Expose container port "80" -> "8080"
    • Add another value/row under the default volume's row (leaving the first un-edited): "/var/www/html:Z" -> "/mnt/pv/wordpress"
      • We need to create a new value/raw because we need to inform docker that we're using SELinux and we want it set the right SELinux context just before attaching the volume to the container (this is why we've added ":Z" to the "mysql" path)
      • In case you've disabled SELinux you can skip the second value/row adding
    • Add all the required container's environment variables:WORDPRESS_DB_HOST -> mariadb
      • WORDPRESS_DB_USER -> wordpress       (Chosen during the configuration of the mariadb container)
      • WORDPRESS_DB_PASSWORD -> *****    (Chosen during the configuration of the mariadb container)
      • WORDPRESS_DB_NAME -> wordpress      (Chosen during the configuration of the mariadb container)
    • Restart policy: always

    At the end we'll see a new row under the Running Containers frame, after clicking on it, we'll see a detailed overview of the running container:

    cockpit-capture-13-containers-192-168-121-43_-https___192-168-121-43_9090_docker

    As you can see all should worked fine, the wordpress container is running.

    Let's check if the persistent volumes are currently used by containers:

    # ls /mnt/pv/
     mariadb/ wordpress/
    
    # ls /mnt/pv/mariadb/
     aria_log.00000001 aria_log_control ibdata1 ib_logfile0 ib_logfile1 multi-master.info mysql performance_schema tc.log wordpress
    
    # ls /mnt/pv/wordpress/
     index.php readme.html wp-admin wp-comments-post.php wp-config-sample.php wp-cron.php wp-links-opml.php wp-login.php wp-settings.php wp-trackback.php
     license.txt wp-activate.php wp-blog-header.php wp-config.php wp-content wp-includes wp-load.php wp-mail.php wp-signup.php xmlrpc.php

     

    We can try browsing to the url: http://your_server_ip:8080, you should see a webpage like the following:

    cockpit-capture-14-wordpress-installation-http___192-168-121-43_8080_wp-admin_install-php

    If you see the welcome page of WordPress, all is ok and your containerized LAMP is working fine!

    Doubts or troubles? Comment!

     

    About Alessandro

    Alessandro

    Alessandro Arrichiello is a Platform Consultant for Red Hat Inc. He has a passion for GNU/Linux systems, that began at age 14 and continues today.
    He worked with tools for automating Enterprise IT: configuration management and continuous integration through virtual platforms.
    He's now working on distributed cloud environment involving PaaS (OpenShift), IaaS (OpenStack) and Processes Management (CloudForms),
    Containers building, instances creation, HA services management, workflows build.

     
    Last updated: September 8, 2023

    Recent Posts

    • Red Hat Advanced Cluster Management 5 multicluster observability add-on guide

    • Red Hat Ansible Certified Content Collection for AWS 12.0.0 delivers predictable enterprise operations

    • Deploying a sealed image mode system on AWS with secure boot

    • Resource management and capacity management on Red Hat OpenShift Virtualization

    • Layered defense in Red Hat Enterprise Linux

    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    Red Hat Developer

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI