Skip to content

Latest commit

 

History

History
75 lines (60 loc) · 4.64 KB

File metadata and controls

75 lines (60 loc) · 4.64 KB

Module 11: Docker

Introduction

Docker containers are an integral part of the development and management of our DevOps workflow. After this module, you should be comfortable with most tasks required to interact and manage containers along with an understanding of their purpose and basic workings.

For this module, create a new Git repo for your Docker work in Module 11.

It is recommended that you read through each of the official documentation resources listed below and follow some of the links within each resource to help clarify specific tools and their purposes.

Resources and articles:


The Test

  1. Install Docker Toolbox on your local machine. Don't forget to run /usr/local/bin/docker-machine env default and eval $(/usr/local/bin/docker-machine env default) use the default environment.

  2. Create a Docker Hub account.

  3. Login to your Docker Hub account using docker login in your terminal window.

  4. Pull down the alpine:3.3 image from Docker Hub.

  5. Create a new file called docker-module.txt, and paste the output of docker images into the file.

  6. Commit your changes and push up.

  7. Run sh interactively inside of the alpine:3.3 container using docker run. You should see a prompt showing / #.

  8. Using apk (more info here), install bash while inside of the container. You'll need add bash using the --no-cache flag.

  9. Start a bash prompt inside of the container, and paste the current prompt into docker-module.txt.

  10. Exit the container.

  11. Commit your changes and push up.

  12. Attempt to run bash inside of the container, and paste the output into docker-module.txt.

    Since containers are immutable, they start in their original state everytime. Since the original state of the container doesn't have bash installed, running the container again restarts the container without bash. This is one of the differences between the way containers and virtual machines handle state.

  13. Commit your changes and push up.

  14. Create a new Dockerfile that extends the alpine:3.3 and installs bash.

  15. Build a new image with the tag realpage/alpine-bash:3.3 using your new Dockerfile.

  16. Attempt to run bash inside of the new realpage/alpine-bash:3.3 container, and paste the output into docker-module.txt.

  17. Exit the container.

  18. Commit your changes and push up.

  19. Create a new executable file called welcome.sh containing the following:

#!/bin/bash
echo 'Hello, World!'
  1. Update the Dockerfile so that welcome.sh is added to /home/welcome.sh when the container is built.

  2. Rebuild the container following the the changes.

  3. Run the welcome.sh script within the container using docker run, and paste the output into docker-module.txt.

  4. Commit your changes and push up.

  5. Update the Dockerfile so that it outputs "Hello, World!" when only running docker run realpage/alpine-bash:3.3.

  6. Rebuild the container and run it via docker run realpage/alpine-bash:3.3.

  7. Paste the output into docker-module.txt.

  8. Commit your changes and push up.

  9. Pull down the dockercloud/hello-world image. You can see the Dockerfile for this image [here](docker pull dockercloud/hello-world).

  10. Run the dockercloud/hello-world image without any arguments or flags.

    The container continues to run and never exits. If you look at the Dockerfile, you can see that php-fpm and nginx are running within the container. Since nginx is run with -g "daemon off;" , the process never exits and neither does the container!

  11. Rerun docker images and paste the output into docker-module.txt.

  12. Commit your changes and push up.


Wrapping Up

When you are done, verify you have pushed your changes to GitHub. Please create a tag called v1.0 with a message of "ready for review" in your docker repo. Be sure your tags are pushed to the remote repository and are visible in GitHub.

Create an issue titled Review Module 11 - Docker and @mention your mentor and team leader.