Monday, April 8, 2019

Docker - Introduction

Greetings!

Let's talk about Docker container ;)

The Problem

Software packaging, distribution, installation is not that easy. It is true that there are easy to use software packages. Normally software depends on other libraries. To install a software it needs to install those dependencies first. What if those libraries have other dependencies? What if there are version conflicts?

Let's see a picture of a software installation.



It is a web of libraries. Now imagine we need to uninstall our software. Will it remove it's dependencies properly. Will that have an impact on other software? How do we install another version? What if you need to main multiple computers with this same setup?

There are many questions though we can somehow solve. Imagine time, energy we spend on these. Is it worth?

Lets say we want install MySQL as the database. Why do we need to spend lot of time for that when our main task is something else. These are reasons we need to find other way to software distribution.

  • Difficult to install.
  • Hard to maintain.
  • Difficult to uninstall.
  • Difficult to test other versions.
  • Difficult to distribute.

What are the solutions

  • Virtualization: People use virtual machines to ship their software. While this solve most of above problems it has it's own issues. It's a machine inside machine which means waste resources.
  • Containers: While containers look like virtual machine, it's not. Containers are isolated from the host system like virtual machines but it shares same host resources reducing replication cost leads to performance boost.

Software installation with Docker container

Docker

Docker is a command line program. A background daemon. Docker simplify container creation. Docker is a tool for container simplification. We only need to give few instructions. Then Docker daemon handle all the heavy work for us.

Docker is a platform for developers and sysadmins to develop, deploy, and run applications with containers. The use of Linux containers to deploy applications is called containerization. Containers are not new, but their use for easily deploying applications is.

Advantages

  • Flexible - Even the most complex applications can be containerized.
  • Lightweight - Containers leverage and share the host kernel.
  • Interchangeable - You can deploy updates and upgrades on-the-fly.
  • Portable - You can build locally, deploy to the cloud, and run anywhere.
  • Scalable - You can increase and automatically distribute container replicas.
  • Stackable - You can stack services vertically and on-the-fly.

Hello World

You can refer the official guide for the Docker installation. For example, for ubuntu https://docs.docker.com/install/linux/docker-ce/ubuntu/.
Make sure Docker is running.

$ docker version
$ docker info
Docker officially has a hello-world image. Let's run it.
$ docker container run hello-world



No comments:

Post a Comment