Question: In the notes, we covered how to search and pull a Docker image from Docker Hub, then run it as a container interactively. In that

In the notes, we covered how to search and pull a Docker image from Docker Hub, then run it as a container interactively. In that container, system administrators can run various services or apps to give extended functionality to their infrastructure. For this problem set, we are going to install the Docker Engine on our Ubuntu Server (if you haven't already from the notes). We will complete the installation as outlined in the notes and add our user account (ie: dmatthews) to the 'docker' group so the engine can be ran as 'dmatthews' and not 'root' for security. There is no need to test with the 'hello-world' image, but if you do that's ok too.
Install the Docker Engine on your Ubuntu Server TealVirt vm. Be sure to update, then install the packages, then add the GPG key and repo, then set the repo for the Docker software.
Set the Docker application to be enabled and restart the service.
Add your user account to the 'docker' group
Test the install by issuing the 'docker info' command.
Now we will search, pull, and run an image needed for our environment. You have a client in your enterprise who needs a VM running Alpine Linux, a distro based on musl and BusyBox. They only need this vm occasionally to test apps they're developing. If you're like me, Alpine is not something you use alot of, nor will this client. With that in mind, it isn't efficient to build a complete virtual machine, update it, patch it securely, keep it maintained, etc... for a user to use a few times. Plus, there's the back and forth of what virtual hardware to have, who's gonna maintain the vm, which versions of various libraries...the headaches are endless. You have decided to use the Alpine Linux Docker image and run it as a container. This idea will certainly work, but you'll need to do a few things first.
Search for and pull down the official Docker image for 'Alpine'
Display the list of all Docker images on your system in the terminal.
Run the image interactively as a container.
This will give you a new prompt. To ensure you're actually running Alpine Linux, issue the command 'cat /etc/os-release' and you should see information about Alpine Linux. Use the TealVirt 'Capture Screenshot Package' utility to capture a PDF screenshot showing the outout of the 'cat...' command. This will be screenshot #1.
You'll need to update the container to ensure you have the latest software. In Alpine, you use the 'apk update' and 'apk upgrade' commands to do so. This shouldn't take long as most Docker images are updated regularly.
For fun, install Neofetch on your Alpine container. Use the 'apk add neofetch' command to do so, then run 'neofetch' to see the output.
Exit out of the container and rename it to 'alpine' instead of the weird default name given.
Start the 'alpine' Docker container and open the Alpine terminal in Bourne shell (docker exec -it alpine sh). The Bourne shell is very limited so we'll need to get BASH available in a few minutes.
Your client user will need the IP address of the Alpine Linux container so they can SSH into the container. Since there are a few 'general maintenance' things we need to do to our Alpine container, we'll cover them now.
First we'll need to add a password for the root user on the container. By default the root user has a password so it's a huge security risk. Set the password to be something you can remember. As with all Linux systems, enter the 'passwd' command to reset the root user's password. Since you're logged in as root, no need to enter 'passwd '.
We'll need to change the default shell for the root user from 'sh' Bourne shell to 'bash' Bourne Again shell. To do to, issue the following commands:
apk add libuser
touch /etc/login.defs
mkdir /etc/default
touch /etc/default/useradd
lchsh root
Enter the root password, the one you just set, then enter '/bin/bash' to set the default shell.
Exit out of the Alpine container to set the new shell, then...because it should still be running...you can re-enter the Alpine Linux container in the BASH shell with the 'docker exec -it alpine bash' command. Do that now.
Use the 'ip a' command to grab the IP address of the Ethernet adapter.
Exit out of the Alpine container with the 'exit' command. The container will still be running, so issue stop the Alpine container.
Output a list of all Docker containers on your machine, not running but all containers. Use the TealVirt 'Capture Screenshot Package' utility to capture a PDF screenshot showing the list of all Docker containers on your machine. This will be screenshot #2.
Finally, I want you to see how we could have gotten the IP address without starting and entering an interactive session in Alpine. Docker gives us commands that will open a container, run a command, then exit and stop the container after the output is displayed.
Clear your screen so the normal Ubuntu Server prompt is displayed. Make sure all docker containers are stopped by

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!