Book Image

Docker Bootcamp

By : Russ McKendrick, Pethuru Raj, Jeeva S. Chelladhurai, Vinod Singh
Book Image

Docker Bootcamp

By: Russ McKendrick, Pethuru Raj, Jeeva S. Chelladhurai, Vinod Singh

Overview of this book

<p>Docker allows you to create a robust and resilient environment to generate portable, composable, scalable, and stable application containers.</p> <p>The book starts by installing the core Docker Engine on MacOS, Windows 10 and Linux desktops. We will then define multi-container applications and understand the advantages of using containers locally. Once this is done, we will deploy containers on a single Docker host which is publicly accessible. Furthermore, we will learn how to deploy and configure a Docker Swarm cluster and explore networking and storage third-party plugins to extend the core Docker functionality. Towards the end, the book will demonstrate how to monitor and troubleshoot day-to-day problems in addition to various real world examples of container deployments.</p>
Table of Contents (15 chapters)

Debugging a Dockerfile


Every instruction we set in the Dockerfile is going to be built as a separate, temporary image for the other instruction to build itself on top of the previous instruction.

There is a Dockerfile in the repo at /bootcamp/ch apter06/debu g:

FROM alpine
RUN ls -lha /home
RUN ls -lha /vars
CMD echo Hello world

Building the image using the following command:

docker image build

Gives you the following output:

So, there is an error in our Docker file. You may notice there is a line in the output which says --->5f828f86eaa4this is actually an image file which was built following the successful execution of the RUN ls -lha / home line.

This means that we can launch a container using this image:

docker container run -it --name=debug 5f828f86eaa4 /bin/sh

Note

Notice that as we are using Alpine Linux as our base we are using /bin/sh rather than /bin/bash

We can then debug our application, which in this case is simple:

Debugging is a process of analyzing what's going on and it's different...