![](/uploads/1/2/5/5/125524959/340825458.jpg)
Using Docker Developing and Deploying Software with Containers book pdf download, Using Docker Developing and Deploying Software with Containers book audiobook download, Using Docker Developing and Deploying Software with Containers book read online, Using Docker Developing and Deploying Software with Containers book epub, Using Docker.
A practical guide to rapidly and efficiently mastering Docker containers, along with tips and tricks learned in the field.
About This Book
- Use Docker containers, horizontal node scaling, modern orchestration tools (Docker Swarm, Kubernetes, and Mesos) and Continuous Integration/Continuous Delivery to manage your infrastructure.
- Increase service density by turning often-idle machines into hosts for numerous Docker services.
- Learn what it takes to build a true container infrastructure that is scalable, reliable, and resilient in the face of increased complexities from using container infrastructures.
- Find out how to identify, debug, and mitigate most real-world, undocumented issues when deploying your own Docker infrastructure.
- Learn tips and tricks of the trade from existing Docker infrastructures running in production environments.
Who This Book Is For
This book is aimed at system administrators, developers, DevOps engineers, and software engineers who want to get concrete, hands-on experience deploying multi-tier web applications and containerized microservices using Docker. This book is also for anyone who has worked on deploying services in some fashion and wants to take their small-scale setups to the next level (or simply to learn more about the process).
What You Will Learn
![Docker tutorial Docker tutorial](/uploads/1/2/5/5/125524959/759453069.png)
- Set up a working development environment and create a simple web service to demonstrate the basics
- Learn how to make your service more usable by adding a database and an app server to process logic
- Add resilience to your services by learning how to horizontally scale with a few containers on a single node
- Master layering isolation and messaging to simplify and harden the connectivity between containers
- Learn about numerous issues encountered at scale and their workarounds, from the kernel up to code versioning
- Automate the most important parts of your infrastructure with continuous integration
In Detail
Deploying Docker into production is considered to be one of the major pain points in developing large-scale infrastructures, and the documentation available online leaves a lot to be desired. With this book, you will learn everything you wanted to know to effectively scale your deployments globally and build a resilient, scalable, and containerized cloud platform for your own use.
The book starts by introducing you to the containerization ecosystem with some concrete and easy-to-digest examples; after that, you will delve into examples of launching multiple instances of the same container. From there, you will cover orchestration, multi-node setups, volumes, and almost every relevant component of this new approach to deploying services. Using intertwined approaches, the book will cover battle-tested tooling, or issues likely to be encountered in real-world scenarios, in detail. You will also learn about the other supporting components required for a true PaaS deployment and discover common options to tie the whole infrastructure together.
At the end of the book, you learn to build a small, but functional, PaaS (to appreciate the power of the containerized service approach) and continue to explore real-world approaches to implementing even larger global-scale services.
Style and approach
This in-depth learning guide shows you how to deploy your applications in production using Docker (from the basic steps to advanced concepts) and how to overcome challenges in Docker-based infrastructures. The book also covers practical use-cases in real-world examples, and provides tips and tricks on the various topics.
Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.
Estimated reading time: 7 minutes Prerequisites
- Install Docker.
- Get Docker Compose as described in Part 3 prerequisites.
- Get Docker Machine as described in Part 4 prerequisites.
- Read the orientation in Part 1.
- Learn how to create containers in Part 2.
- Make sure you have published the
friendlyhello
image you created bypushing it to a registry. We use thatshared image here. - Be sure your image works as a deployed container. Run this command,slotting in your info for
username
,repo
, andtag
:docker run -p 80:80username/repo:tag
, then visithttp://localhost/
. - Have the final version of
docker-compose.yml
from Part 5 handy.
Introduction
You’ve been editing the same Compose file for this entire tutorial. Well, wehave good news. That Compose file works just as well in production as it doeson your machine. In this section, we will go through some options for running yourDockerized application.
Choose an option
Customers of Docker Enterprise Edition run a stable, commercially-supportedversion of Docker Engine, and as an add-on they get our first-class managementsoftware, Docker Datacenter. You can manage every aspect of your applicationthrough the interface using Universal Control Plane, run a private image registry with DockerTrusted Registry, integrate with your LDAP provider, sign production images withDocker Content Trust, and many other features.
Bringing your own server to Docker Enterprise and setting up Docker Datacenteressentially involves two steps:
- Get Docker Enterprise for your server’s OS from Docker Hub.
- Follow the instructions to install Docker Enterprise on your own host.
Note: Running Windows containers? View our Windows Server setup guide.
Once you’re all set up and Docker Enterprise is running, you can deploy your Composefile from directly within the UI.
After that, you can see it running, and can change any aspect of the applicationyou choose, or even edit the Compose file itself.
Install Docker Engine --- Community
Find the install instructions for Docker Engine --- Community on the platform of your choice.
Create your swarm
Run
docker swarm init
to create a swarm on the node.Deploy your app
Run
docker stack deploy -c docker-compose.yml getstartedlab
to deploythe app on the cloud hosted swarm.Your app is now running on your cloud provider.
Run some swarm commands to verify the deployment
You can use the swarm command line, as you’ve done already, to browse and managethe swarm. Here are some examples that should look familiar by now:
- Use
docker node ls
to list the nodes in your swarm.
- Use
docker service ls
to list services.
- Use
docker service ps <service>
to view tasks for a service.
Open ports to services on cloud provider machines
At this point, your app is deployed as a swarm on your cloud provider servers,as evidenced by the
docker
commands you just ran. But, you still need toopen ports on your cloud servers in order to:- if using many nodes, allow communication between the
redis
service andweb
service - allow inbound traffic to the
web
service on any worker nodes so thatHello World and Visualizer are accessible from a web browser. - allow inbound SSH traffic on the server that is running the
manager
(this may be already set on your cloud provider)
These are the ports you need to expose for each service:
Service | Type | Protocol | Port |
---|---|---|---|
web | HTTP | TCP | 80 |
visualizer | HTTP | TCP | 8080 |
redis | TCP | TCP | 6379 |
Methods for doing this vary depending on your cloud provider.
We use Amazon Web Services (AWS) as an example.
What about the redis service to persist data?
To get the
redis
service working, you need to ssh
intothe cloud server where the manager
is running, and make a data/
directory in /home/docker/
before you run docker stack deploy
.Another option is to change the data path in the docker-stack.yml
toa pre-existing path on the manager
server. This example does notinclude this step, so the redis
service is not up in the example output.Iteration and cleanup
From here you can do everything you learned about in previous parts of thetutorial.
- Scale the app by changing the
docker-compose.yml
file and redeployon-the-fly with thedocker stack deploy
command. - Change the app behavior by editing code, then rebuild, and push the new image.(To do this, follow the same steps you took earlier to build theapp and publish theimage).
- You can tear down the stack with
docker stack rm
. For example:
Unlike the scenario where you were running the swarm on local Docker machineVMs, your swarm and any apps deployed on it continue to run on cloudservers regardless of whether you shut down your local host.
Congratulations!
You’ve taken a full-stack, dev-to-deploy tour of the entire Docker platform.
There is much more to the Docker platform than what was covered here, but youhave a good idea of the basics of containers, images, services, swarms, stacks,scaling, load-balancing, volumes, and placement constraints.
Want to go deeper? Here are some resources we recommend:
- Samples: Our samples include multiple examples of popular softwarerunning in containers, and some good labs that teach best practices.
- User Guide: The user guide has several examples thatexplain networking and storage in greater depth than was covered here.
- Admin Guide: Covers how to manage a Dockerized productionenvironment.
- Training: Official Docker courses that offerin-person instruction and virtual classroom environments.
- Blog: Covers what’s going on with Docker lately.
![](/uploads/1/2/5/5/125524959/340825458.jpg)