Docker Introduction

What is Docker

Docker is a software containerization platform. It is open source, https://github.com/docker/docker, and is capable of running any application as a lightweight container.

What are Docker Containers?

Docker containers are a standardized unit that wraps a piece of software into a complete filesystem. These containers has everything contained inside for the software to run. This includes software code, system tools, system libraries etc. Basically if it can be installed on a server it can be installed on a docker container. By containerizing apps your software becomes hardware-agnostic and platform-agnostic. This means you can run your software anywhere.

Docker vs VM

A common method to distribute and sandbox applications is via virtual machines (VM). This can also be done via Docker, in fact Docker is a better solution over VMs for the following reasons:

  1. Size: VMs are typically very large in terms of memory and makes it impractical to transfer or store.
  2. Performance: VMs typically require a large amount of computing power in terms of CPU and memory. Docker containers share the same operating system kernel, uses less RAM and CPU almost zero memory and CPU overhead. 
  3. Portability: Different VM vendors may not neccesarily integrate and perform well with each other. Typically a conversion tool is required which adds additional overhead to CPU and memory. 

Some benefits that VMs have over Docker inculde:

  1. Isolation: Apps running on VMs are more isolated then apps running in separate containers on the same machine in Docker.
  2. Security: Compared to VMs docker containers have more access to the running kernel and therefore has more chances to escape. 
  3. Kernel Dependency: Docker can only run apps that are compatible with the base kernel. This means you cannot run Windows apps on a linux container.

What is Docker Hub?

Docker Hub is a cloud service that contains a library of image repositories. These image repositories also contains official repositories of software including products from Canonical, Oracle and Red Hat. There are plenty more features of Docker Hub, you can read more about them at https://docs.docker.com/docker-hub/

What is Docker Compose?

Docker Compose is a tool to define and run multiple container Docker applications. In order to build and run multiple containers a Compose file is required to configure the application's different services. Once your application is configured you can create, start, remove, build and many more from a single command from the terminal/command prompt.

What is a Dockerfile?

A Dockerfile is a text document that contains all the commands a user could call from the command line/terminal to create an image. This file is used in order to automate the build process by executing several command-line instructions in succession.

Conclusion

To see an example of using Docker Compose to run multiple containers with Django please go to this tutorial: Docker Compose for Django

Subscribe to our mailing list

* indicates required