Graham is a RHEL Sysadmin at Google.
- His RHEL Server: RHEL_Server_023
- His username: firstname.lastname@example.org
- His professional preference: Good RHEL Sysadmins never run commands as the root user.
- His certifications: CompTIA Linux+, LPIC 1, 2 and 3, LFCS, RHCSA, and RHCE
- His task: Manage and configure containers
Graham Tutt has just been promoted to this position: Director of Training at Google.
Google has just hired 47 RHEL Engineers:
- 7 graduates from the University of Michigan, Ann Arbor
- 12 graduates from Hampton University
- 9 graduates from UCLA
- 4 graduates from Morehouse
- 3 graduates from BYU
- 12 graduates from the University of North Carolina
Graham has 1 week to teach these candidates everything that he knows about containers on Linux. Please generate and explain several commands that will make these 47 students experts in managing and configuring containers.
To help Graham Tutt teach the 47 RHEL Engineers about managing and configuring containers on Linux, here are several commands that he can use to explain and demonstrate container-related concepts:
sudo dnf install docker
- Explanation: This command installs Docker, a popular containerization platform, on RHEL. The
sudocommand is used to execute the installation with elevated privileges.
Starting the Docker Service:
sudo systemctl start docker
- Explanation: This command starts the Docker service, allowing containers to be created and managed. The
systemctlcommand is used to control system services, and
startis the action to start the Docker service.
Pulling a Docker Image:
docker pull image-name
- Explanation: This command downloads a Docker image from a registry, such as Docker Hub. Replace
image-namewith the name of the desired image. For example, to pull the official Nginx image:
- docker pull nginx
Running a Docker Container:
docker run -d --name container-name image-name
- Explanation: This command creates and runs a Docker container from a specified image. The
-dflag runs the container in detached mode,
--namesets a custom name for the container, and
image-namerefers to the Docker image to use. For example, to run an Nginx container named
- docker run -d --name my-nginx nginx
Listing Running Containers:
- Explanation: This command lists the running Docker containers on the system. It provides information such as the container ID, image used, and container status. Running containers are displayed, while stopped or exited containers are excluded.
Stopping a Docker Container:
docker stop container-name/container-id
- Explanation: This command stops a running Docker container. Replace
container-namewith the custom name assigned to the container or use the
container-idto identify it. For example, to stop the
- docker stop my-nginx
Removing a Docker Container:
docker rm container-name/container-id
- Explanation: This command removes a stopped Docker container. Use the
container-idto specify the container to be removed. For example, to remove the
- docker rm my-nginx
These commands cover fundamental aspects of managing and configuring containers using Docker. Graham can explain each command's purpose, demonstrate their usage, and provide hands-on exercises for the students to gain practical experience in container management. Additionally, he can introduce additional concepts such as Docker networking, volume management, and Dockerfile creation to enhance their understanding and prepare them for managing containers in real-world scenarios.