Book Image

Developing with Docker

By : Jaroslaw Krochmalski, Jarosław Krochmalski
Book Image

Developing with Docker

By: Jaroslaw Krochmalski, Jarosław Krochmalski

Overview of this book

This fast-paced practical guide will get you up and running with Docker. Using Docker, you will be able to build, ship, and run many distributed applications in real time. You will start with quickly installing Docker and start working with images and containers. We will present different types of containers and their applications, and show you how to find and build images. You will learn how you can contribute to the image repository by publishing different images. This will familiarize you with the image building process and you will be able to successfully run your programs within containers. By finishing this book, you will be well equipped in deploying your applications using Docker and will have a clear understanding of concepts, techniques, and practical methods to get it running in production systems.
Table of Contents (16 chapters)
Developing with Docker
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Preface

Docker has got a lot of attention in the last few years. Today it has thousands of community contributors, countless numbers of containers downloads, and more and more third party projects using it. It seems that its acclaim will grow even more in the next few years. In this book, we will try to explain this extraordinary popularity and show how you can benefit from faster and simpler application development, testing, and deployment. We will learn Docker from a developer’s perspective mostly and focus on creating, running, and publishing Docker images, rather than managing and clustering them. We will begin with the basic ideas and advantages which Docker brings to the developer’s tool set.

What this book covers

Chapter 1, Introduction to Docker, briefly describes what Docker is and how it can be useful in modern software development and deployment. We will point out what advantages come with the tool and why it is helpful. This chapter will also demonstrate how the containers containing code, runtime, system tools, and libraries can speed up the development and deployment, at the same time making it a more enjoyable experience.

Chapter 2, Installing Docker, contains the brief description of the available tools, such as Docker CLI or Kinematic (Docker GUI). Next, we will go straight to the action--installing the tools. The chapter will give precise and practical instructions on how to install the Docker Toolbox on Mac, Linux, and Windows. The chapter will also describe the process of installing Docker in the cloud, such as Amazon AWS.

Chapter 3,  Understanding Images and Containers, talks about the Docker’s architecture. We will explain the terminology related to working with it. After reading this chapter you will understand the concepts and architecture behind Docker; it is a must when going through the next chapters.

Chapter 4Networking and Persistent Storage, describes the Dockers networking and storage concepts. The chapter will introduce the reader to containers networking and present different kind of containers (open, closed, bridged and joined). The reader will also get familiar with the idea of volumes and their types. Additionally, the reader will learn how to manage, mount, and share Docker volumes.

Chapter 5Finding Images, describes the process of identifying software, finding and installing it with the Docker Hub, and the alternative sources. After reading this chapter, the reader will be able to find a specified image in the Docker repository and then install it.

Chapter 6, Creating Images, tells the reader how to write a Dockerfile, how to build an image from it, and get familiar with the image build process. The chapter will contain the best practices for writing Dockerfiles and useful tips and tricks for dealing with the images.

Chapter 7Running Containers, tells us how to run programs within containers. The chapter will describe the concept of starting, stopping, restarting, listing, and viewing the container output. The reader will run multiple programs in a container and get familiar with injecting the configuration into the container. We will also describe the container life cycle and the cleanup process.

Chapter 8, Publishing Images, familiarizes us with the process of packaging software for distribution. After reading this chapter, the reader will be able to create a Docker Hub account & repository. Then, he will push his image up to it so other people with Docker Engine can run it. The chapter will also describe the process of private software distribution. At the end of the chapter, the reader will pull his own image from the repository to test the process.

Chapter 9 , Using Docker in Development,  discusses how to incorporate building Docker images into the Maven build process. To do that, we will utilize docker-maven plugins. We will also package a Java web application running on Spring Boot embedded server. To demonstrate the process of packaging a static web application into Docker container we will also run angular.js application with node.js backend from inside the Docker container.

Appendix A, More resources, directs you to some more useful resources for further reading, such as forums, blogs, and websites related to Docker. The chapter will also mention some useful third party tools related to Docker and show how they can be useful when working with Docker.

What you need for this book

You will need a Mac or PC, running OS X, MS Windows or Linux to be able to setup and run Docker. You can download Docker for free. You can read how to get and install it in Chapter 2, Installing Docker.

Who this book is for

This book is aimed at being a fast-paced and practical guide to get you up and running with Docker. It targets developers, IT professionals, DevOps, or anyone looking to quickly develop and deploy software to production at scale. If you are interested in Docker, DevOps, or containers in general, don’t look any further.

You will start with installing Docker and start working with images and containers. We will present different types of containers, their applications and show how to find and build images. This will allow you to familiarize with the image building process and you will be able to successfully run your programs within containers. By finishing this book, you will be well equipped in deploying your applications using Docker and will have a clear understanding of concepts, techniques, and practical methods to get it running in production systems.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Mount the downloaded WebStorm-10*.dmg disk image file as another disk in your system."

A block of code is set as follows:

html, body, #map {
 height: 100%;
 margin: 0;
 padding: 0
}

Any command-line input or output is written as follows:

$ mkdir css
$ cd css

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "The shortcuts in this book are based on the Mac OS X 10.5+ scheme."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book--what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.