Debugging Containers

Debugging has been an artistic component in the field of software engineering. All kinds of software building blocks individually, as well as collectively, need to go through a stream of deeper and decisive investigations by software development and testing professionals to ensure the security and safety of the resulting software applications. As Docker containers are said to be key runtime environments for next generation mission-critical software workloads, it is pertinent and paramount for containers, crafters, and composers to embark on a systematic and sagacious verification and validation of containers.

This chapter has been dedicatedly written to enable technical guys who have all the accurate and relevant information to meticulously debug both the applications running inside containers and the containers themselves. In this chapter, we will also look at the theoretical aspects of process isolation for processes running as containers. A Docker container runs at a user-level process on host machines and typically has the same isolation level as provided by the operating system. With the latest Docker releases, many debugging tools are available which can be efficiently used to debug your applications. We will also cover the primary Docker debugging tools, such as docker exec, stats, ps, top, events, and logs. The current version of Docker is written in Go and it takes advantage of several features of the Linux kernel to deliver its functionality.

The list of topics that will be covered in this chapter is as follows:

  • Process-level isolation for Docker containers
  • Debugging a Dockerfile
  • Debugging a containerized application
All the commands in this chapter are tested on an Ubuntu environment and if you are running them on a local Mac environment, the results would differ.

After installing the Docker Engine on your host machine, the Docker daemon can be started with the -D debug option:

$ docker -D login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username (vinoddandy):

This -D debug flag can be enabled to the Docker configuration file (/etc/default/docker) also in the debug mode:

DOCKER_OPTS="-D"  

After saving and closing the configuration file, restart the Docker daemon.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset