Use Docker to Containerize Your Services!

By @firemouse5/22/2018linux

What is Docker?

Docker is a program that performs operating-system-level virtualization known as containerization. Containers are a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings.

The below image shows a docker host running three containers allowing compartmentalization of services.
Package software.png

The Basics

Images An image is the base snapshot of a container. You can create an image yourself or they can be downloaded from Docker Hub. There are many images to choose from like Ubuntu, Nginx etc.
Containers A container is an instance that spawned from an image. Containers feel like virtual machines, but they are actually just resticted processes with their own runtime environment.
Swarms Docker Swarms are similar to clustering. Swarms are a group of docker hosts working together to host containers. There are manager and worker nodes. Managers dish out the work and the workers host the containers.
Compose Files These files contain commands to build a docker image.

Get started in three steps!

1. Installing

apt-get install docker.io

2. Pulling an Image (Ubuntu in the example)

docker pull ubuntu

3. Start a container with the image you pulled

docker run -i -t ubuntu /bin/bash

There you have it. You just installed docker, downloaded an image and started a container in three easy commands!

Practical example

SteemEngine.net utilizes docker to containerize every service. This allows us to easily scale out our service on demand as required. Here is an example:

  • The load balancer is a simple nginx image with a few customizations. It sends traffic to the SteemEngine webservers.
  • There are multiple Steemengine webserver containers.
  • These webserver containers talk to a backend database container.
  • All maintenance scripts open in new containers.

More helpful commands

If you want more commands - check out the docker cheat sheet


Need help getting started?

Feel free to leave a comment or question below or chat with me on the SteemEngine discord https://discord.gg/y7h45ut

68

comments