Book Image

Docker Quick Start Guide

By : Earl Waud
Book Image

Docker Quick Start Guide

By: Earl Waud

Overview of this book

Docker is an open source software platform that helps you with creating, deploying, and running your applications using containers. This book is your ideal introduction to Docker and containerization. You will learn how to set up a Docker development environment on a Linux, Mac, or Windows workstation, and learn your way around all the commands to run and manage your Docker images and containers. You will explore the Dockerfile and learn how to build your own enterprise-grade Docker images. Then you will learn about Docker networks, Docker swarm, and Docker volumes, and how to use these features with Docker stacks in order to define, deploy, and maintain highly-scalable, fault-tolerant multi-container applications. Finally, you will learn how to leverage Docker with Jenkins to automate the building of Docker images and the deployment of Docker containers. By the end of this book, you will be well prepared when it comes to using Docker for your next project.
Table of Contents (10 chapters)

What this book covers

Chapter 1, Setting up a Docker Development Environment, covers getting everything set up for Docker development on our workstation. We learn how to set up a Docker development environment on Linux, Windows, and OS X workstations. We will then handle some post-installation steps for each OS. Lastly, we will learn how using Docker on each OS differs and what to watch out for between them.

Chapter 2, Learning Docker Commands, introduces a number of essential Docker commands. While we focus on one of the most important commands, the container run command, we will also cover many other commands that you will be using on a daily basis. These commands include the list container command, the stop container command, and the remove container command. Along the way, we will also discover other container commands, such as logs, inspect, stats, attach, exec, and commit. I think you will find this chapter to be an excellent foundation in terms of your Docker education.

Chapter 3, Creating Docker Images, covers how to create enterprise-grade Docker images. We will start off by learning about the main building block of Docker images; specifically, the Dockerfile. We will then explore all the instructions available to use in a Dockerfile. There are some instructions, that, on the face of it, will seem very similar. We will uncover the differences between the COPY and ADD instructions, the ENV and ARG instructions, and, most importantly, between the CMD and ENTRYPOINT instructions. Then, we will find out what the build context is and why it is important. Finally, we will cover the actual image build command.

Chapter 4, Docker Volumes, uncovers the secrets of Docker volumes. We will learn how to use folders on your workstation inside your Docker containers, as well as how to create and use persistent volumes, allowing multiple containers to share data. We will learn how to clean up after unused volumes. And finally, to round it out, we will learn how to create data volume containers to become the source of volumes for other containers.

Chapter 5, Docker Swarm, covers what Docker swarm is, and how to set up a Docker swarm cluster. We will find out more about swarm managers and swarm workers. We will discover Swarm Services. We will find out how easy it is to access a container application running on any node in the swarm cluster.

Chapter 6, Docker Networking, introduces Docker networking. We will dive deep into Docker networking, learning how containers can be isolated, how they can communicate with each other, and how they can communicate with the outside world. We will explore the local network drivers Docker provides in the out-of-the-box installation. We will then examine the use of remote network drivers with an example deployment of the Weave driver. After that, we will learn how to create Docker networks and round out the discussion with a look at the free services that we get with our Docker networks.

Chapter 7, Docker Stacks, brings together everything we will have learned in the first six chapters in order to be able to define, deploy, and manage multi-container applications. We will achieve this via the use of Docker stacks. We are going to learn how to use Docker stacks and the YAML files required to define multi-container applications. And, we will leverage what we learned about Docker services, Docker volumes, Docker swarm, and Docker networking to create full-featured, multi-service Docker-based applications.

Chapter 8, Docker and Jenkins, covers how to leverage Jenkins to build our Docker images and deploy our Docker containers. We will learn how to deploy our Jenkins server as a Docker container. We will follow that by learning how to build Docker images within the Dockerized Jenkins server. This is what is often referred to as Docker in Docker. Finally, we will see how to utilize Docker containers as the Jenkins build agents, allowing every build to be run in a pristine, ephemeral Docker container. Of course, we will show how to build Docker images, test applications, and push tested images to a Docker registry, all within our Dockerized Jenkins build agents. This will provide you with all the tools you will need to set up your CI/CD systems.