Working with Docker Images

Hands-On Lab

 

Photo of Terrence Cox

Terrence Cox

Senior Vice President of Content

Length

00:30:00

Difficulty

Beginner

Time to put your Docker image skills to the test! In this lab, you will use your newfound knowledge of Docker images to pull, build, and launch containers.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Working with Docker Images

Introduction

Time to put your Docker image skills to the test! In this lab, you will use your newfound knowledge of Docker images to pull, build, and launch containers.

Solution

  1. Begin by logging in to the lab server using the credentials provided on the hands-on lab page:

    ssh cloud_user@PUBLIC_IP_ADDRESS

Pull the latest Alpine image

  1. Pull the latest alpine image from Docker Hub.

    docker image pull alpine:latest
  2. You can confirm it is there with:

    docker images

Pull the latest httpd image

  1. Pull the latest httpd image.

    docker pull httpd:latest

    > Note: If you don't put the version, the latest version is assumed.

Pull nginx 1.15

  1. Pull nginx version 1.15.

    docker pull nginx:1.15
  2. To confirm that it is there:

    docker images

Compare the history

  1. Look at the history for both the httpd and nginx images.

    docker history httpd
  2. Note the following command gives an error because the latest version is assumed:

    docker history nginx
  3. When you specify the right version, the command succeeds:

    docker history nginx:1.15

Conclusion

Congratulations — you've completed this hands-on lab!