Book Image

Developing with Docker

By : Jaroslaw Krochmalski, Jarosław Krochmalski
Book Image

Developing with Docker

By: Jaroslaw Krochmalski, Jarosław Krochmalski

Overview of this book

This fast-paced practical guide will get you up and running with Docker. Using Docker, you will be able to build, ship, and run many distributed applications in real time. You will start with quickly installing Docker and start working with images and containers. We will present different types of containers and their applications, and show you how to find and build images. You will learn how you can contribute to the image repository by publishing different images. This will familiarize you with the image building process and you will be able to successfully run your programs within containers. By finishing this book, you will be well equipped in deploying your applications using Docker and will have a clear understanding of concepts, techniques, and practical methods to get it running in production systems.
Table of Contents (16 chapters)
Developing with Docker
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Container exit codes and restart policies


You can specify the so called restart policy using the--restart switch with the docker run command. Restart policy tells Docker how to behave on container shutdown. It can be restarted to minimize downtime, for example if running on production server. However, before we explain the Docker restart policy, let's focus on the exit codes. The exit code is crucial information, it tells why the container failed to run or why it exited. Sometimes it's related to the contained command you will give to docker run as a parameter.

When the dockerrun command ends with a non-zero code, the exit codes follow the chroot standard, as you can see in the following example:

  • exit code 125:The docker run command fails by itself

  • exit code126: The supplied command cannot be invoked

  • exit code 127: The supplied command cannot be found

  • Other, non-zero, application dependent exit code.

As you can recall, in the previous chapters we have been using the dockerps command to list the...