Docker
A Project-Based Approach to Learning
Jason Cannon
LinuxTrainingAcademy.com
Copyright 2021 Jason Cannon
All rights reserved
No part of this book may be reproduced, or stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without express written permission of the publisher.
Contents
Online Resources
To download all the exercises contained in this book, as well as additional resources, visit https://www.LinuxTrainingAcademy.com/docker . Any updates or corrections to this book will be shared there as well.
Introduction and Overview
Welcome to this book on Docker, where you'll learn the ins-and-outs of the world's most popular container platform.
My name is Jason Cannon, and I'm the author of several best-selling Linux books, including Linux for Beginners and Command Line Kung Fu . I've also created dozens of courses that have helped people just like you level-up their careers by teaching them valuable, in-demand skills. I've been using Docker since its release, and I've put all of my best Docker tips, tricks, and techniques into this book.
In order for you to get Docker up and running as quickly as possible, the beginning of the book will show you how to install it on your chosen operating system. It will outline how to start, stop, and resume containers, how to display important information about those containers, and how to use the built-in Docker help system.
From there, you'll learn all about Docker images: what images are, where to get them, how to manage them, and even how to create your very own custom images. Youll also learn how to create a private Docker image registry, so you can have complete control over your images in your environment. If you're worried about keeping sensitive data out of the wrong hands, you can deploy a private registry.
Next, you'll learn how to manage the data needed by and created by your Docker containers. You'll learn about the different ways to persist data between container runs, including how to make the most of Docker volumes. Plus, you'll find out how to view and manage the output and logs generated by your containers.
I will demonstrate how Docker supervises network traffic, including how it routes traffic from the outside world to and from a given container, and how it isolates containers for greater security. Most importantly, you'll learn why, when, and how to create and manage Docker networks for your specific needs and applications.
Having taught thousands of students over the years, Ive found that people learn best by doing. To help you with this, there are practice exercises throughout the book, each with detailed, step-by-step instructions.
Not only will you learn the concepts, you will be able to put those concepts to good use by practicing these new skills immediately so that you fully understand and retain what you're learning.
Each project and exercise will allow you to build upon the skills you've acquired along the way. By the end of this book, you'll be able to deploy complex applications using multi-container configurations, user-defined networks, and Docker volumes with ease.
This book is ideal for anyone who has a desire to learn how to configure, deploy, and manage Docker systems, Docker containers, Docker registries, Docker orchestrators, or Dockerized applications.
Whether you're a developer, programmer, or a software engineer looking for best-practices to deploy your applications quickly and easily using Docker; or a System Administrator, Systems Engineer, or Operations Engineer who needs to support Docker deployments, this book is for you.
Ultimately, this is the perfect guide for those who are looking to advance their careers by learning a key DevOps Skill: Docker.
So, if you're tired of being scared of Docker, or simply aren't making the progress you'd hope for by dabbling with Docker containers, it's time to take your Docker skills to the next level by reading this book.
Installing Docker
In this chapter, you will learn which edition of Docker to install and why. It can be a relatively complicated choice for newcomers to Docker, as there are so many options. Here, we will cover the differences between the available versions, so you can decide which best suits your requirements. Additionally, you'll learn how to install Docker on various operating systems, including Windows, Mac, and Linux.
Docker Community Edition vs. Docker Enterprise Edition
The two main versions of the Docker Engine promoted by Docker today are Docker CE, which is the Community Edition, and Docker EE, which is the Enterprise Edition. This book is based on the Community Edition, as it is suitable for individuals, small teams of developers, and even large organizations that want to run Docker without paying a subscription fee. In short, the Community Edition is free for anyone to download and run.
The Enterprise Edition provides additional premium features that are not included in the Community Edition, such as being able to verify that images created by vendors are trustworthy and verified. These images are certified by ISVs (Independent Software Vendors), and work seamlessly with Docker Enterprise Edition. The Docker Enterprise Edition is a commercial product, available for a fee.
Another Docker offering is Docker Enterprise, which is not related to the Docker Engine, but rather a container platform with a full suite of extras. These extras include the ability to scan container images for common vulnerabilities, as well as access to an orchestrator such as Docker Swarm or Kubernetes.
Docker Community Edition Channels
There are three types of update channels for Docker CE. The most commonly used is the stable update channel, which contains software that has been thoroughly tested. The second channel is called test, and contains software that hasn't yet completed testing. Finally, the nightly channel contains the most recent work in progress. We will focus on the stable channel, as we want to ensure our Docker environment has been thoroughly tested and works. If you install from a nightly build, for example, you may run into unexpected bugs and other issues. Again, I highly recommend using the stable channel unless you are testing a new feature that Docker hasn't yet promoted to the stable version.
One thing to note is that releases of Docker CE are supported through patches that are available for approximately seven months after each versions release. Docker EE extends that support to approximately twenty-four months after a new version is released.
Installing Docker on Windows
In this section, you're going to learn how to install Docker on Windows. If you want to install Docker on another operating system, such as Mac or Linux, skip ahead to the section that corresponds to your operating system.
Before you install Docker on Windows, let's discuss some requirements. At the time of publication, Docker requires at least Windows 10 Pro, Windows 10 Enterprise, or Windows 10 Education Edition. Currently, Docker is not supported on Windows 10 Home Edition.
Also, Docker requires that virtualization be enabled in your physical computer's BIOS. Sometimes it's labeled as VT-x for Intel processors or AMD-V for AMD processors. This varies depending on the manufacturer, so consult the documentation for your specific computer. Luckily, this is usually already enabled, but if you run into any issues, double check and make sure that virtualization is enabled in your BIOS. Note that this is different from having Hyper-V enabled. These virtualization settings are at the hardware level, not at the operating system level.