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

Using Dockerfiles


Now that we understand what every other Dockerfile instruction does, we can prepare our first Dockerfile. As mentioned earlier, it's just a plain text file. Once you've created a Dockerfile and added all your instructions, you can use it to build an image using the docker build command. The format for this command is:

docker build [OPTIONS] <PATH or URL> | -

The docker build command takes some arguments and options, you can display them with a short description using the -help switch, as with any other Docker command:

docker build -help

There are options to tweak the build process by specifying the CPU and memory setup or turning off the cache, for example. You can also tag the new repository after the build, using the -t option, for example:

docker build -t jarek/myapp .

To tag the image into multiple repositories at once, you can also add multiple -t parameters:

docker build -t jarek/myapp:1.0.0 -t jarek/myapp:latest .

The default set of parameters related to CPU...