Docker — Beginner Notes

Deepak Kashyap
4 min readJul 17, 2019

This post is more of like key pointers being copy pasted during learning Basics of Docker from various different courses/portals.

  1. Containers usually contain an application and its dependencies, such as libraries and frameworks. Multiple containers can run on a single host.
  2. Containers decouple applications from operating systems so that you can have a clean and minimal Linux operating system and run everything else in some form of containers. Because a container offers a convenient unit to encapsulate a small application component, it’s a good infrastructure for building micro-service applications, which enable manageable application infrastructure and continuous application deliveries.
  3. Containers are just a process (or a group of processes) running in isolation, which is achieved with Linux namespaces and control groups. Linux namespaces and control groups are features that are built into the Linux kernel. Other than the Linux kernel itself, there is nothing special about containers.
  4. Containers achieve isolation because of ‘namespaces’ feature in the Linux kernel
  5. A container separates the bridges b/w Dev and Ops in DevOps
    Dev: Focus on Application Development
    - Code/Libraries/Configuration/Server Runtime/OS
    Ops: Focus on Deployment Environment
    - Logging/Remote Access/Network Configuration/Monitoring
  6. Docker is an open platform for developers and system administrators to build distributed applications.
  7. With Docker, you can manage your infrastructure in the same ways that you manage your applications. By taking advantage of Docker methodologies for shipping, testing, and quickly deploying code, you can reduce the delay between writing code and running it in production i.e Docker provides developers and operators with a friendly interface to build, ship, and run containers on any environment.
  8. LinuxKit makes it possible to run Docker containers on operating systems other than Linux
  9. Use the Dockerfile to create reproducible builds for your application and to integrate your application with Docker into the CI/CD pipeline.
  10. Docker images can be made available to all of your environments through a central registry. The Docker Hub is one example of a registry, but you can deploy your own registry on servers you control.
  11. A Docker image contains all the dependencies that it needs to run an application within the image. This is useful because you no longer need to deal with environment drift (version differences) when you rely on dependencies that are installed on every environment you deploy to.
  12. Docker uses of the union file system and “copy-on-write” to reuse layers of images. This lowers the footprint of storing images and significantly increases the performance of starting containers.
  13. Image layers are cached by the Docker build and push system. There’s no need to rebuild or repush image layers that are already present on a system.
  14. Each line in a Dockerfile creates a new layer, and because of the layer cache, the lines that change more frequently, for example, adding source code to an image, should be listed near the bottom of the file
Docker Cheat Sheet
Container Ecosystem layers

Docker Swarm

  • Docker Swarm schedules services by using a declarative language. You declare the state, and the swarm attempts to maintain and reconcile to make sure the actual state equals the desired state.
  • Docker Swarm is composed of manager and worker nodes. Only managers can maintain the state of the swarm and accept commands to modify it. Workers have high scalability and are only used to run containers. By default, managers can also run containers.
  • The routing mesh built into Docker Swarm means that any port that is published at the service level will be exposed on every node in the swarm. Requests to a published service port will be automatically routed to a container of the service that is running in the swarm.

Terminologies

Image: A read-only snapshot of a container that is stored in Docker Hub or in private repository. You use an image as a template for building containers. An image is the blueprint for spinning up containers. An image is a TAR of a file system, and a container is a file system plus a set of processes running in isolation.

Container: The standard unit where the application service is located or transported.

Registry: The registry stores, distributes, and shares container images. It is available in software as a service (SaaS) or in an enterprise to deploy anywhere you that you choose. Docker Hub is a popular registry.

Docker Engine: A program that creates, ships, and runs application containers. The engine runs on any physical or virtual machine or server locally, in private or public cloud. The client communicates with the engine to run commands.

Dockerfile: An entity that stores a simple, descriptive set of instructions.

Recommendations

Overview of containers and docker : IBM cloud garage content which provides information about basic terminologies. (1 Hour)

Docker Essentials: A Developer Introduction : Free course to enroll and get yourself a digital badge and certification. Course contains 3 lab exercises which provides hands-on required and relates corresponding theoretical concepts.(2-3 Hours)

Docker Get Started Tutorials : Official docker get started documentation

If you are working on Docker, please share your tips and experiences in the comment section below.

--

--