Skip to main content
  1. Posts/

Docker is a Game-Changer

·3 mins
Docker Devops
Table of Contents

What is Docker
#

Docker container is similar to virtual machine (VM), both of them provides virtualization to isolate environment. Though they are completely different technology, the isolation is similar and so people are easily confused to utilize containers as VMs.

Why Docker?
#

In order to make portable environment, engineer usually choose to write a number of scripts to reproduce the steps or ship with a VMs. The former requires a clear and completed document for troubleshooting while the latter uses up a certain amount of disk space and network traffic for transfer. Both are not ideal solution to overcome the daily life of developer.

Docker containers, on the one hand, share host OS kernel which greatly reduced the image size when comparing to VMs. On the other hand, containers are pre-built with Dockerfile and users can skip the step of running scripts, implying that it is ready to run once you downloaded the container image. Due to its simplicity, the performance is comparable to running natively at host and highly portable attracts hundreds of thousands of users to start using it.

Pros
#

  • Easy to Start: To start a Docker container, it is usually a command like docker run hello-world to get started. Configuration usually come with a set of arguments passing as environment into the containers, like docker run -e SOME_ENV=val hello-world.
  • Lightweight: Containers share the host OS kernel. Resources assigned to the containers are occupied by the process instead of a completed guest OS, which means an fast start-up time, subtle memory and cpu consumption.
  • Portable: Each containers are built when they appear on the cloud. You can easily run the application with simply an one-line command.
  • Secure: Docker implements lots of security features to isolate host environment from containers. The guests always require specific permissions or configurations in order to access to the host as well as other guests.

Cons
#

  • Persistent Storage is Complicated: By design, the data inside container are flushed when the container shuts down. Beginners have to take times on learning how volume works in order to have clear concept about Docker.
  • Devices Passthrough: If you would utilize Docker as VM, then more times you need to study on the device passthrough and the security flags about Docker. Running GUI application would be complicated without proper passthrough and authorization settings.
  • Not All Applications can Benefit: Docker is best fit for microservice in which a single process is running in a container. When the application requires multiple processes, it may incur certain level of overhead though some workarounds introduce to use supervisord or similar process manager.

Dive Deep
#

If you want to learn more about Docker, I would recommend to look into jessfraz/dockerfiles. There are lots of examples of using Docker to start graphical applications or to play audio. If you start shipping your applications into Docker, you are on the way to be a Docker master.