Want to pass the RHCSA9 exam? This section of the RHCSA9 Exam Series: Operate Running Systems will review how to operate running systems–a key skill
Looking to enhance your Linux skillset? RHCSA 9 Container Management Skills introduces a new section on container management, making it a must-have competency for any aspiring Linux professional. Develop the skills and knowledge needed to manage containers using various tools and commands with ease.
As the world shifts towards containerized applications, managing containers has become an essential skill for Linux professionals. Red Hat Certified System Administrator (RHCSA) 9 exam has introduced a new section on container management, which focuses on managing containers using various tools and commands. In this article, we will discuss the “Manage Containers” section of the RHCSA 9 exam and provide examples of how to perform various container management tasks.
$ docker pull
For example, to pull the latest version of the Nginx web server image, we can use the following command:
$ docker pull nginx:latest
$ podman pull
For example, to pull the latest version of the Nginx web server image using Podman, we can use the following command:
$ podman pull docker.io/library/nginx:latest
Before running a container, it is important to inspect its image to ensure that it is the correct version and that it meets all the requirements. The following commands can be used to inspect a container image:
$ docker inspect
For example, to inspect the Nginx web server image, we can use the following command:
$ docker inspect nginx:latest
$ podman inspect
For example, to inspect the Nginx web server image using Podman, we can use the following command:
$ podman inspect docker.io/library/nginx:latest
Using Commands Such as Podman and Skopeo Podman and Skopeo are command-line tools that can be used for container management. They are alternatives to Docker CLI and can perform most of the same tasks. The following commands can be used to perform container management using Podman and Skopeo:
$ podman ps # List running containers
$ podman run # Run a container
$ podman stop # Stop a container
For example, to list all running containers using Podman, we can use the following command:
$ podman ps
$ skopeo copy # Copy an image from one registry to another
$ skopeo inspect # Inspect an image
For example, to copy an image from Docker Hub to Red Hat Quay using Skopeo, we can use the following command:
$ skopeo copy docker://nginx:latest docker://quay.io/my-repo/nginx:latest
A Containerfile is a text file that contains instructions for building a container image. The following commands can be used to build a container from a Containerfile:
$ docker build -t
For example, to build a container image of Nginx web server from a Containerfile, we can use the following command:
$ docker build -t nginx-web-server:latest .
$ podman build -t
For example, to build a container image of Apache web server from a Containerfile, we can use the following command:
$ podman build -t apache-web-server:latest .
In this section, we’ll review performing basic container management such as running, starting, stopping, and listing containers.
Basic container management involves tasks such as running, starting, stopping, and listing running containers. The following commands can be used to perform basic container management tasks:
$ docker run # Run a container
$ docker start # Start a stopped container
$ docker stop # Stop a running container
$ docker ps # List running containers
For example, to run a container of Ubuntu Linux using Docker CLI, we can use the following command:
$ docker run ubuntu:latest
$ podman run # Run a container
$ podman start # Start a stopped container
$ podman stop # Stop a running container
$ podman ps # List running containers
For example, to run a container of CentOS Linux using Podman CLI, we can use the following command:
$ podman run centos:latest
Containers are often used to run services such as web servers, databases, and messaging brokers. The following commands can be used to run a service inside a container:
$ docker run --name -d
For example, to run a MySQL database server inside a Docker container, we can use the following command:
$ docker run --name mysql-server -d mysql:latest
$ podman run --name -d
For example, to run a PostgreSQL database server inside a Podman container, we can use the following command:
$ podman run --name postgresql-server -d postgres:latest
Systemd is a system and service manager for Linux operating systems. It can be used to manage containers as well. The following commands can be used to configure a container to start automatically as a systemd service:
$ docker run --name -d
$ docker update --restart=always
For example, to configure a Docker container running the Nginx web server to start automatically as a systemd service, we can use the following commands:
$ docker run --name nginx-server -d nginx:latest
$ docker update --restart=always nginx-server
$ podman generate systemd -n # Generate systemd unit file for the container
$ systemctl enable .service # Enable and start the container as a systemd service
For example, to configure a Podman container running the Apache web server to start automatically as a systemd service, we can use the following commands:
$ podman generate systemd apache-server -n
$ systemctl enable apache-server.service
Persistent storage is important for applications that require data to be stored between container restarts. The following commands can be used to attach persistent storage to a container:
$ docker run --name -v :
For example, to attach a persistent storage volume to a Docker container running the MariaDB database server, we can use the following command:
$docker run --name mariadb-server -v /opt/mariadb-data:/var/lib/mysql -d mariadb:latest
$ podman run --name -v :
For example, to attach a persistent storage volume to a Podman container running the MongoDB database server, we can use the following command:
$ podman run --name mongodb-server -v /opt/mongodb-data:/data/db -d mongo:latest
In this article, we have discussed the Manage Containers section of the RHCSA 9 exam. We have covered various topics such as finding and retrieving container images from a remote registry, inspecting container images, performing container management using commands such as podman and skopeo, building a container from a Containerfile, performing basic container management such as running, starting, stopping, and listing running containers, running a service inside a container, configuring a container to start automatically as a systemd service, and attaching persistent storage to a container.
By following the examples provided in this article, Linux professionals can gain the necessary knowledge and skills to manage containers effectively and pass the Manage Containers section of the RHCSA 9 exam.
Was this article helpful to you? If so, leave us a comment below. We appreciate you feedback!
Related Posts
Want to pass the RHCSA9 exam? This section of the RHCSA9 Exam Series: Operate Running Systems will review how to operate running systems–a key skill
In this section of the RHCSA9 Exam Series: Understand and use essential tools, we will examine some of the essential tools that may appear on
Are you ready to take on the RHCSA 9 exam? Our comprehensive guide on creating and configuring file systems in RHCSA will equip you with