Popular Certification Courses

LiNUX Lab

Implement Images #1

Objectives

We will create a Docker image using a base image. We will then instantiate an instance from the image, log in to that instance, and ensure all works as expected.

Overview

In this lab, we will put into practice some of the Dockerfile commands that we have learned. Using what we know, we will create a Dockerfile that uses a base CentOS image, install apache on this image, then extract the contents of a tar file that we created as for Apache to use. We will then build out image and run it, before logging in to the running Docker instance and checking that it does what is required. We will then use a web client on the host to ensure it works.

Scenarios

1. Install Docker, and configure the service so that it is running.
2. Create a folder to store your files. Call it greatwebsite.
3. Create an index.html file.
4. Create a tar file called index.tar from the index.html file.
5. Create a Dockerfile. Use CentOS 6 as the base image.
6. Inside the Dockerfile, install Apache, extract the tar file, expose the web port, and start Apache.
7. Build a Docker image from the Dockerfile.
8. Run docker image and expose the Apache port.
9. Connect to the running container, and check that the file is in the correct location and that apache is running.
10. Install a web client on the host, and test the Apache instance.
11. Stop the container instance, and verify it has stopped.
12. Delete the Apache container completely from the host system.
13. List all stopped containers to verify it has been removed.