Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon

Free eBook - Docker Cookbook - Second Edition

4.6 (5 reviews total)
By Cochrane , Jeeva S. Chelladhurai , K Khare
  • A new free eBook every day on the latest in tech
  • 30 permanently free eBooks from our core tech library
  1. Introduction and Installation
About this book
Docker is an open source tool used for creating, deploying, and running applications using containers. With more than 100 self-contained tutorials, this book examines common pain points and best practices for developers building distributed applications with Docker. Each recipe in this book addresses a specific problem and offers a proven, best practice solution with insights into how it works, so that you can modify the code and configuration files to suit your needs. The Docker Cookbook begins by guiding you in setting up Docker in different environments and explains how to work with its containers and images. You’ll understand Docker orchestration, networking, security, and hosting platforms for effective collaboration and efficient deployment. The book also covers tips and tricks and new Docker features that support a range of other cloud offerings. By the end of this book, you’ll be able to package and deploy end-to-end distributed applications with Docker and be well-versed with best practice solutions for common development problems.
Publication date:
August 2018
Publisher
Packt
Pages
352
ISBN
9781788626866

 

Working with Docker Containers

In this chapter, we will cover the following recipes:

  • Listing/searching for an image
  • Pulling an image
  • Listing images
  • Starting a container
  • Listing containers
  • Looking at the container logs
  • Stopping a container
  • Removing a container
  • Removing all stopped containers
  • Setting the restart policy on a container
  • Getting privileged access inside a container
  • Accessing the host device inside a container
  • Injecting a new process into a running container
  • Reading a container's metadata
  • Labeling and filtering containers
  • Reaping a zombie inside a container
 

Introduction

In the previous chapter, after installing Docker, we pulled an image and created a container from it. Docker's primary objective is running containers. In this chapter, we'll see the different operations we can perform with containers, such as starting, stopping, listing, deleting, and so on. This will help us use Docker for different use cases, such as testing, CI/CD, setting up PaaS, and so on, which we'll cover in later chapters. Before we start, let's verify the Docker installation by running the following command:

    $ docker version  

This will give the Docker client and server version, as well as other details.

I am using Ubuntu 18.04 as my primary environment in which to run these recipes. They should also work with the other environments.
About the Authors
  • Cochrane

    Ken Cochrane is an experienced technologist, architect, author, and leader. He has extensive professional experience leading software development teams, developing and implementing scalable web solutions, and delivering high-quality, highly functional web applications that are currently in use by millions of people worldwide. Ken was previously a member of the founding teams of Docker and CashStar. He is now currently the senior director of enterprise architecture for WEX, a global leader in financial technology solutions. Ken coauthored the book Docker Cookbook - Second Edition, published by Packt in 2018. He currently resides in Southern Maine with his wife, Emily, and two sons, Zander and Maddox.

    Browse publications by this author
  • Jeeva S. Chelladhurai

    Jeeva S. Chelladhurai has been working as a DevOps specialist at the IBM Global Cloud Center of Excellence (CoE) in India for the past 8 years. He has more than 20 years of experience in the IT industry. In various capacities, he has technically managed and mentored diverse teams across the globe in envisaging and building pioneering telecommunication products. He specializes in DevOps and cloud solution delivery, with a focus on data center optimization, software-defined environments (SDEs), and distributed application development, deployment, and delivery using the newest Docker technology. Jeeva is also a strong proponent of agile methodologies, DevOps, and IT automation. He holds a master's degree in computer science from Manonmaniam Sundaranar University and a graduate certificate in project management from Boston University. He has been instrumental in crafting reusable assets for IBM solution architects and consultants in Docker-inspired containerization technology.

    Browse publications by this author
  • K Khare

    Neependra K Khare is the founder and principal consultant at CloudYuga. CloudYuga provides training and consulting on Docker, Kubernetes, GO Programming, and so on. He is one of the Docker Captains and has run Docker Meetup Group in Bangalore for around 4 years. In 2015, he authored a book on Docker, Docker Cookbook. In 2016, he coauthored a course on Cloud Infrastructure Technologies at Edx for the Linux Foundation. Recently, he authored a course on Kubernetes on Edx, for the Linux Foundation.

    Browse publications by this author
Latest Reviews (5 reviews total)
everything went well. quick and simple.
Awesome books, great deals.
Easy to use and provide various formats to read.
Recommended For You
Learn Docker - Fundamentals of Docker 19.x - Second Edition

Explore the core functionality of containerizing your applications and making them production-ready

By Gabriel N. Schenker
40 Algorithms Every Programmer Should Know

Learn algorithms for solving classic computer science problems with this concise guide covering everything from fundamental algorithms, such as sorting and searching, to modern algorithms used in machine learning and cryptography

By Imran Ahmad
The Docker Workshop

Get started with Docker on your local machine and progress towards deploying useful applications in production with this simplified, practical guide

By Vincent Sesto and 4 more
Docker for Developers

Learn how to deploy and test Linux-based Docker containers with the help of real-world use cases

By Richard Bullington-McGuire and 2 more