Working With Prebuilt Docker Images

30 minutes
  • 5 Learning Objectives

About this Hands-on Lab

After installation, the best way to familiarize yourself with Docker, is to run containers from a few prebuilt images. In this lab, you will explore Docker Hub for images that will run a website. Once you find suitable images, you will get them into your development environment, and begin experimenting. You will run, stop, and delete containers from those images. You will also learn how to use existing data in containers.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Explore Docker Hub
  1. Find web server containers. For this lab, we will be using httpd and nginx.
  2. View the Description and Tags. Click the latest tag in the Description to see the Dockerfile.

    Note: You will be working with Prebuilt Docker images from Docker Hub. Take some time to explore Docker Hub and familiarize yourself with the site’s features.

Get and View `httpd`
  1. Get the httpd image from Docker Hub, using the 2.4 tag.
  2. Run a container named "httpd" from the httpd image. Map server port 8080, to port 80 in the container.
  3. In a browser, go to the public IP of your server on port 8080, to verify the httpd webserver is running.
Run a Copy of the Website in `httpd`
  1. Clone the existing website code onto the server. The website is available at https://github.com/linuxacademy/content-widget-factory-inc.
  2. Stop and delete your currently running httpd container.
  3. Create a new httpd container, and mount the website data. Don’t forget to map the port!
  4. In a browser, go to the public IP of your server on port 8080, to verify the website is displaying.
Get and View `nginx`
  1. Get the latest nginx image from Docker Hub.
  2. Run a container named "nginx" from the nginx image. Map server port 8081, to port 80 in the container.
  3. In a browser, go to the public IP of your server on port 8081, to verify the nginx webserver is running.
Run a Copy of the Website in `nginx`
  1. Stop and delete your current running nginx container.
  2. Create a new nginx container, mounting the website data into the container. Remember to map the port!
  3. In a browser, go to the public IP of your server on port 8081, to verify the website is displaying.

Additional Resources

You are tasked with migrating a website, from a traditional server, into containers. Once Docker is installed, how do you start developing a solution to your assignment? You will run the website in multiple web server containers, from prebuilt images on Docker Hub, to become familiar with how containers work.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?