Manage and configure containers
Graham is a RHEL Sysadmin at Google.
- His RHEL Server: RHEL_Server_023
- His username: graham.tutt@google.com
- 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:
Docker Installation:
- Command:
sudo dnf install docker
- Explanation: This command installs Docker, a popular containerization platform, on RHEL. The
sudo
command is used to execute the installation with elevated privileges.
- Command:
Starting the Docker Service:
- Command:
sudo systemctl start docker
- Explanation: This command starts the Docker service, allowing containers to be created and managed. The
systemctl
command is used to control system services, andstart
is the action to start the Docker service.
- Command:
Pulling a Docker Image:
- Command:
docker pull image-name
- Explanation: This command downloads a Docker image from a registry, such as Docker Hub. Replace
image-name
with the name of the desired image. For example, to pull the official Nginx image: - docker pull nginx
- Command:
Running a Docker Container:
- Command:
docker run -d --name container-name image-name
- Explanation: This command creates and runs a Docker container from a specified image. The
-d
flag runs the container in detached mode,--name
sets a custom name for the container, andimage-name
refers to the Docker image to use. For example, to run an Nginx container namedmy-nginx
: - docker run -d --name my-nginx nginx
- Command:
Listing Running Containers:
- Command:
docker ps
- 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.
- Command:
Stopping a Docker Container:
- Command:
docker stop container-name/container-id
- Explanation: This command stops a running Docker container. Replace
container-name
with the custom name assigned to the container or use thecontainer-id
to identify it. For example, to stop themy-nginx
container: - docker stop my-nginx
- Command:
Removing a Docker Container:
- Command:
docker rm container-name/container-id
- Explanation: This command removes a stopped Docker container. Use the
container-name
orcontainer-id
to specify the container to be removed. For example, to remove themy-nginx
container: - docker rm my-nginx
- Command:
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.