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

Runtime modes - detached and foreground


When running a container, you have a choice to run it in the foreground or detached mode. Let's start with the detached mode.

Detached

You can start a Docker container in a detached mode with adoption. The container starts up and runs in the background. After the container startup, you can use the console for executing other commands. Dockerfile can launch only one process at a time. Take note of the fact that the containers started in detached mode exit when the root process used to run the container exits. Understanding this is important even if you have some process running in the background (started from the instruction in the Dockerfile). Docker will stop the container if the command that started the container finishes. In other words, Docker requires your command to keep running in the foreground; otherwise, it thinks that your application stops and shuts down the container. For example, if the default command in your container is bash, when you...