RHCSA Rapid Track
In this exercise, you will install container tools and test them by running a simple rootless container.
Outcomes
You should be able to install container management tools and use them to run a container.
On the workstation machine, log in as the student user with student as the password.
On the workstation machine, run the lab containers-basic start command.
This command runs a start script to determine whether the servera machine is reachable on the network.
It also checks and configures the container registry and ensures that the container image used for this exercise is stored there.
[student@workstation ~]$lab containers-basic start
Procedure 16.1. Instructions
Use the
sshcommand to log in toserveraas thestudentuser. The systems are configured to use SSH keys for authentication, so a password is not required.[student@workstation ~]$ssh student@servera...output omitted...[student@servera ~]$Install the container-tools Yum module using the
yumcommand.[student@servera ~]$sudo yum module install container-tools[sudo] password for student:student...output omitted...Is this ok [y/N]:y...output omitted... Complete!Log in to the container registry using the
podman logincommand.[student@servera ~]$podman login registry.lab.example.comUsername:adminPassword:redhat321Login Succeeded!Pull a container image from the registry with the fully qualified name using the
podman pullcommand.[student@servera ~]$podman pull registry.lab.example.com/rhel8/httpd-24:latestTrying to pull registry.lab.example.com/rhel8/httpd-24:latest... Getting image source signatures Copying blob 77c58f19bd6e done Copying blob 47db82df7f3f done Copying blob 9d20433efa0c done Copying blob 71391dc11a78 done Copying config 7e93f25a94 done Writing manifest to image destination Storing signatures 7e93f25a946892c9c175b74a0915c96469e3b4845a6da9f214fd3ec19c3d7070Run a container from the image, connect it to the terminal, assign it a name, and then start an interactive bash shell using the
podman runcommand. Thelatesttag is assumed since no tag is specified:The following
podman runcommand is very long and should be entered as a single line.[student@servera ~]$podman run --name myweb -it registry.lab.example.com/rhel8/httpd-24 /bin/bashbash-4.4$List running processes within the container. You will see only those processes running in the container. You will not see any other processes that are running on the server.
bash-4.4$ps auxUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND default 1 6.6 0.1 12020 3120 pts/0 Ss 21:52 0:00 /bin/bash default 6 0.0 0.1 44596 3296 pts/0 R+ 21:52 0:00 ps auxDisplay the current user name and ID inside the container.
bash-4.4$iduid=1001(default) gid=0(root) groups=0(root)Exit from the container shell.
bash-4.4$exitexitRun the
httpd -vcommand in a container, using therhel8/httpd-24container image, and delete the container when the command exits:The following
podman runcommand is very long and should be entered as a single line.[student@servera ~]$podman run --rm registry.lab.example.com/rhel8/httpd-24 httpd -vServer version: Apache/2.4.37 (Red Hat Enterprise Linux) Server built: Dec 2 2019 14:15:24Exit from
servera.[student@servera ~]$exitlogout Connection to servera closed.[student@workstation ~]$
This concludes the guided exercise.