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

Configuring the Docker daemon remote API


As we know, Docker has a client-server architecture. When we install Docker, a user space program and a daemon get started from the same binary. The daemon binds to unix://var/run/docker.sock by default on the same host. This will not allow us to access the daemon remotely. To allow remote access, we need to start Docker such that it allows remote access, which can done by changing the -H flag appropriately.

Getting ready

Depending on the Linux distribution you are running, figure out the Docker daemon configuration file you need to change. For Fedora, /Red Hat distributions, it would be /etc/sysconfig/docker and for Ubuntu/Debian distributions , it would most likely be /etc/default/docker.

How to do it…

  1. On Fedora 20 systems, add the -H tcp://0.0.0.0:2375 option in the configuration file (/etc/sysconfig/docker), as follows:

    OPTIONS=--selinux-enabled -H tcp://0.0.0.0:2375 
    
  2. Restart the Docker service. On Fedora, run the following command:

    $ sudo systemctl...