Docker Cookbook
Over 100 practical and insightful recipes to build distributed applications with Docker , 2nd Edition
- 352 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Docker Cookbook
Over 100 practical and insightful recipes to build distributed applications with Docker , 2nd Edition
About This Book
Leverage Docker to deploying software at scale
Key Features
- Leverage practical examples to manage containers efficiently
- Integrate with orchestration tools such as Kubernetes for controlled deployments
- Learn to implement best practices on improving efficiency and security of containers
Book Description
Docker is an open source platform for building, shipping, managing, and securing containers. Docker has become the tool of choice for people willing to work with containers. Since the market is moving toward containerization, Docker will definitely have a big role to play in the future tech market.
This book starts with setting up Docker in different environment, and helps you learn how to work with Docker images. Then, you will take a deep dive into network and data management for containers. The book explores the RESTful APIs provided by Docker to perform different actions, such as image/container operations. The book then explores logs and troubleshooting Docker to solve issues and bottlenecks. You will gain an understanding of Docker use cases, orchestration, security, ecosystems, and hosting platforms to make your applications easy to deploy, build, and collaborate on. The book covers the new features of Docker 18.xx (or later), such as working with AWS and Azure, Docker Engine, Docker Swarm, Docker Compose, and so on.
By the end of this book, you will have gained hands-on experience of finding quick solutions to different problems encountered while working with Docker.
What you will learn
- Install Docker on various platforms
- Work with Docker images and containers
- Container networking and data sharing
- Docker APIs and language bindings
- Various PaaS solutions for Docker
- Implement container orchestration using Docker Swarm and Kubernetes
- Container security
- Docker on various clouds
Who this book is for
Book is targeted towards developers, system administrators, and DevOps engineers who want to use Docker in his/her development, QA, or production environments.
It is expected that the reader has basic Linux/Unix skills such as installing packages, editing files, managing services, and so on.
Any experience in virtualization technologies such as KVM, XEN, and VMware will be an added advantage
Frequently asked questions
Information
Working with Docker Images
- Creating an image from a container
- Creating an account with Docker Hub
- Logging in and out of a Docker image registry
- Publishing an image to a registry
- Looking at the history of an image
- Removing an image
- Exporting an image
- Importing an image
- Building an image using a Dockerfile
- Building an Apache image - a Dockerfile example
- Setting up a private index/registry
- Automated builds - with GitHub and Bitbucket
- Creating a custom base image
- Creating a minimal image using a scratch base image
- Building images in multiple stages
- Visualizing the image hierarchy
Introduction
Creating an image from the container
$ docker container commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
Getting ready
How to do it...
- Let's start a container from an ubuntu image using the docker container run command:
- Having launched the container, issue apt-get update from the container prompt to sync the package list, as shown in the following screenshot:
- Install the apache2 package using the apt-get install command:
- Now, open another terminal and create an image using the docker container run command:
How it works...
There's more...
$ docker diff 6289e32373bf ...OUTPUT SNIPPED... C /var/log C /var/log/alternatives.log A /var/log/apache2 A /var/log/apache2/access.log A /var/log/apache2/error.log A /var/log/apache2/other_vhosts_access.log ... OUTPUT SNIPPED...
- A: This is for when a file/directory has been added
- C: This is for when a file/directory has been modified
- D: This is for when a file/directory has been deleted
Table of contents
- Title Page
- Copyright and Credits
- Dedication
- Packt Upsell
- Contributors
- Preface
- Introduction and Installation
- Working with Docker Containers
- Working with Docker Images
- Network and Data Management for Containers
- Docker Use Cases
- Docker APIs and SDKs
- Docker Performance
- Docker Orchestration and Hosting a Platform
- Docker Security
- Getting Help and Tips and Tricks
- Docker on the Cloud
- Other Books You May Enjoy