Marcos is a RHEL Sysadmin a cPanel:
- His HREL Server: Marcos_RHEL_Server_019
- His username: firstname.lastname@example.org
- His professional preference: RHEL Sysadmins should NEVER run Linux commands as the root user.
- His objective: Configure container engines, create and manage containers.
Marcos is studying for his LFCS exam, and he wants to master this objective. Please generate and explain example commands that Marcos will have to run to complete this objective.
As a RHEL Sysadmin, Marcos can achieve his objective of configuring container engines and managing containers by using commands with appropriate user privileges. Here are some example commands that Marcos can run to accomplish specific tasks related to container management:
- sudo dnf install docker
- This command installs the Docker container engine on the RHEL server. By using the
sudocommand, Marcos elevates his privileges temporarily to execute the installation command as the root user. This follows his professional preference of not running commands as the root user unless necessary.
- Start the Docker service:
- sudo systemctl start docker
- This command starts the Docker service, allowing Marcos to use Docker commands to manage containers. Again, Marcos utilizes
sudoto run the command with elevated privileges.
- Enable Docker to start on system boot:
- sudo systemctl enable docker
- This command configures the Docker service to start automatically whenever the RHEL server boots up.
- Pull a container image from a registry:
- sudo docker pull image_name:tag
- This command downloads a container image from a registry. Marcos should replace
tagwith the specific image name and version tag he intends to use.
- List downloaded container images:
- sudo docker images
- Run a container from an image:
- sudo docker run -d --name container_name image_name:tag
- This command creates and starts a container from a specific image. Marcos needs to provide a unique
container_nameand specify the
tagof the desired image.
- View running containers:
- sudo docker ps
- This command lists the containers that are currently running on the server.
- Stop a running container:
- sudo docker stop container_name
- Remove a container:
- sudo docker rm container_name
- This command removes a container from the server. Marcos needs to specify the
container_nameto identify the container to be removed.
These are example commands that Marcos can run as a RHEL Sysadmin to configure container engines, download and manage containers on his RHEL server. By utilizing the
sudo command, Marcos adheres to his professional preference of not running commands as the root user unless necessary, ensuring better security and accountability.