Book Image

Docker Cookbook

By : Neependra Khare
Book Image

Docker Cookbook

By: Neependra Khare

Overview of this book

<p>Docker is a Linux container engine that allows you to create consistent, stable, and production-quality environments with containers.</p> <p>You will start by installing Docker and understanding and working with containers and images. You then proceed to learn about network and data management for containers. The book explores the RESTful APIs provided by Docker to perform different actions such as image/container operations. Finally, the book explores logs and troubleshooting Docker to solve issues and bottlenecks. This book will also help you understand Docker use cases, orchestration, security, ecosystems, and hosting platforms to make your applications easy to deploy, build, and collaborate on.</p>
Table of Contents (17 chapters)
Docker Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Pulling an image


After searching the image, we can pull it to the system by running the Docker daemon. Let's see how we can do that.

Getting ready

Make sure the Docker daemon is running on the host and you can connect through the Docker client.

How to do it…

  1. To pull an image on the Docker registry, run the following command:

    docker pull NAME[:TAG]
    

The following is an example to pull the Fedora image:

$ docker pull fedora

How it works…

The pull command downloads all layers from the Docker registry, which are required to create that image locally. We will see details about layers in the next chapter.

There's more…

  • Image tags group images of the same type. For example, CentOS can have images with tags such as centos5, centos6, and so on. For example, to pull an image with the specific tag, run the following command:

    $ docker pull centos:centos7
    
  • By default, the image with latest tag gets pulled. To pull all images corresponding to all tags, use the following command:

    $ docker pull --all-tags centos
    
  • With...