Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Building Container Images Using Dockerfiles

Creating a container image by hand is possible, but it requires manual processes. There has to be a more automatic way to build images. Manual processes do not scale and are not easily version controlled. Docker provides a solution to this problem - the Dockerfile. In this lab, you will create a Dockerfile to build an image to host a static website.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Beginner
Duration
Clock icon 45m
Published
Clock icon Nov 20, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Build a First Version

    1. Create a Dockerfile that uses httpd:2.4 as the base image, then runs basic package updates.
    2. Build the 0.1 version of the widgetfactory image using the Dockerfile.
    3. Inspect the image to see its size and layers.
  2. Challenge

    Load the Website into the Container

    1. Remove the Apache welcome page from the image.
    2. Build version 0.2 of the widgetfactory image.
    3. Inspect both versions of the widgetfactory image to see the differences in size and layers.
    4. Add the website data to the container.
    5. Build version 0.3 of the widgetfactory image.
    6. Inspect versions 0.2 and 0.3 to see the differences in size and layers.
  3. Challenge

    Run a Container from the Image

    1. Run a container from the widgetfactory:0.3 image in the terminal, to see which command it executes. Remember to publish the web server port.
    2. Stop the container running in the terminal, then start it in detached mode.
    3. View the website files in the container.
    4. Retrieve the main website page from the container and compare it to the copy on the server.
  4. Challenge

    Read Me

    Note: Many of the things done in this lab are intentionally inefficient, These tasks are done to demonstrate certain aspects of Docker, and highlight common pitfalls. These do not represent best practices.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans