Skip to main content

Running Your First Docker Container

Hands-On Lab

 

Length

00:30:00

Difficulty

Beginner

Welcome to your first challenge in The Quest for More Yummies. In this hands-on lab, we are tasked with preparing our environment for maximum snack acquisition for the people of SpaceBones by installing Docker and then acquiring images from DockerHub.

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.

Running Your First Docker Container

Welcome to your first challenge in The Quest for More Yummies. In this hands-on lab, we are tasked with preparing our environment for maximum snack acquisition for the people of SpaceBones by installing Docker and then acquiring images from DockerHub.

Solution

Open a terminal session and log in to the server via SSH using the credentials listed on the lab page:

ssh cloud_user@<PUBLIC IP>

Install Docker from the Default CentOS 7 Repository

  1. Install the latest version of Docker using yum:

    sudo yum -y install docker

Set User Permissions

  1. Drop down to root:

    sudo -i
  2. Create a new group named docker:

    groupadd docker
  3. Add the cloud_user user to the group:

    usermod -aG docker cloud_user

Enable and Start Docker Service

  1. Enable and start the Docker service:

    systemctl enable --now docker
  2. Back out of root:

    logout
  3. Log out of the cloud_user session:

    logout
  4. Log back in:

    ssh cloud_user@<PUBLIC IP>

Run the hello-world Container Image

  1. Run the hello-world container image to verify installation:

    docker run docker.io/hello-world

Pull Images

  1. Pull the following images into your Docker repository to prepare for the next exercise:

    docker pull 06kellyjac/nyancat
    docker pull jeremy646/doge

Conclusion

Congratulations on successfully completing this hands-on lab!