Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Docker for Developers

You're reading from   Docker for Developers Develop and run your application with Docker containers using DevOps tools for continuous delivery

Arrow left icon
Product type Paperback
Published in Sep 2020
Publisher Packt
ISBN-13 9781789536058
Length 468 pages
Edition 1st Edition
Tools
Arrow right icon
Authors (3):
Arrow left icon
Richard Bullington-McGuire Richard Bullington-McGuire
Author Profile Icon Richard Bullington-McGuire
Richard Bullington-McGuire
Michael Schwartz Michael Schwartz
Author Profile Icon Michael Schwartz
Michael Schwartz
Andrew K. Dennis Andrew K. Dennis
Author Profile Icon Andrew K. Dennis
Andrew K. Dennis
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Section 1: An Introduction to Docker – Containers and Local Development
2. Chapter 1: Introduction to Docker FREE CHAPTER 3. Chapter 2: Using VirtualBox and Docker Containers for Development 4. Chapter 3: Sharing Containers Using Docker Hub 5. Chapter 4: Composing Systems Using Containers 6. Section 2: Running Docker in Production
7. Chapter 5: Alternatives for Deploying and Running Containers in Production 8. Chapter 6: Deploying Applications with Docker Compose 9. Chapter 7: Continuous Deployment with Jenkins 10. Chapter 8: Deploying Docker Apps to Kubernetes 11. Chapter 9: Cloud-Native Continuous Deployment Using Spinnaker 12. Chapter 10: Monitoring Docker Using Prometheus, Grafana, and Jaeger 13. Chapter 11: Scaling and Load Testing Docker Applications 14. Section 3: Docker Security – Securing Your Containers
15. Chapter 12: Introduction to Container Security 16. Chapter 13: Docker Security Fundamentals and Best Practices 17. Chapter 14: Advanced Docker Security – Secrets, Secret Commands, Tagging, and Labels 18. Chapter 15: Scanning, Monitoring, and Using Third-Party Tools 19. Chapter 16: Conclusion – End of the Road, but not the Journey 20. Other Books You May Enjoy

Using containers to further optimize data center resources

Docker is a clever use of OS-level virtualization support that allows multiple Docker containers to execute on a single machine. A container is a running instance of a container image. The containers are, by default, isolated from the host machine, as well as from one another.

They can be configured to expose resources, such as networking ports, to the host network (for example, the internet) or to one another. The following diagram illustrates the basic structure of containers on a host:

Figure 1.5 – Docker containerization

Figure 1.5 – Docker containerization

Containers share their Linux kernel with the host, so you do not need to install complete operating systems within the container as you do with virtual machines. The containers are managed by the Docker daemon, which handles the management of the containers and resources they use, as well as the images, networks, volumes, and so on.

An important distinction between virtual servers and containers is that containers share the resources, directly, of the host, whereas virtual servers require duplicate resources. For example, two identical containers use the host's RAM, rather than a block of RAM configured before booting the virtual machine. If you need to constrain the resources (the CPU, memory, swap, and so on) of a container, you can do so, but the default is to have no resource constraints on any container.

Unlike with virtual servers, you deal with an application image, rather than a virtual disk. You can copy the image to back it up, but there is no virtual disk file to copy. These application images are progressively built on top of other containers. When you build a container, only the bits of the application image that change need to be dealt with.

When designing services that use containers, you will not likely install many components within any one container. For a virtual machine running a LAMP application, you might install Apache, MySQL, and PHP all within one virtual machine. When designing the same LAMP application for containers, you might configure one container just for MySQL and another for Apache and PHP. You can then scale your application by running additional Apache and PHP containers and additional MySQL instances in a cluster configuration.

If we consider the use of containers for the LAMP application discussed earlier, we can implement MySQL in a dedicated container, and Apache and PHP in another; all this running on top of the host's Linux kernel. To scale the LAMP application, a second, third, fourth, and so on instance of the Apache/PHP container can be spun up, and the same is true for the MySQL container. MySQL containers can be configured for master-subordinate operations.

If the host operating system is not Linux kernel-based, there are two options. The first option is to run host OS native containers (for example, Windows containers on a Windows host). The second option is to run a Linux virtual machine on the host and run the containers within that virtual machine.

Containerization is a boon for hosting companies and their customers. No longer is it required to dedicate a fixed amount of RAM per container as is required with virtual machines. A physical machine is limited only by its resources when it comes to the number of containers it can run concurrently. The pricing model for containers can save customers on monthly costs. Thus, containerization is a big win.

In the next chapter, we'll look at how to use virtual machines and Docker to develop applications locally. Later in this book, we'll look at how to deploy our locally developed software to publicly accessible internet/cloud infrastructure.

You have been reading a chapter from
Docker for Developers
Published in: Sep 2020
Publisher: Packt
ISBN-13: 9781789536058
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime