≡ Menu

Cloud

What is Docker? An absolute beginner’s guide

To the uninitiated, we are not talking about Docker clothing company, which makes the popular Men’s Khakis. What we are talking about is the Docker that has changed the way Software Applications are bulit, shipped and run. You have probably heard about Docker and how cool it is, but never really understood fully. And you are itching to finally sit down and read about it. You have come to the right place. In this blogpost, I’m going to demystify Docker for you.  By reading this post fully, you will understand,

  1. What the heck is Docker?
  2. What makes Docker so invaluable and indispensable?
  3. How to install Docker on your PC or MAC?
  4. Most commonly used Docker commands
  5. A full working example

Docker image

Ready? Let’s begin.

What the heck is Docker?

Docker provides a way for Applications to be built and run in a container with all the required software packaged in it. 

But you ask, what in the world is container?

Container is a Docker process that can be run on any Linux or Windows based system. It includes everything it needs to run, including System lirbaries, application code, application dependencies and configuration files. (You throw Docker container in a Car’s bumper and it will still work. Just kiddin.) Containers running on a system share the Operating System Kernel with other processes (including other Docker containers). A Docker container is a mini-machine in its own right.

Tip: You can list all the Docker containers running your system by running the command

docker ps

docker-container

To contrast this with how software applications are traditionally run, look at the image below.

docker-container-1

At this point, you may be wondering, ‘Wait a minute. I’ve seen this before. Are you not talking about virutalization? Vmware and stuff?

Not really. Simply put, vmware virutalizes the underlying hardware resources. But Docker virtualizes the Operating System that runs on top of Vmware virutal machine.

docker-container-vm.png

At this point, if you have been doing Application Support for a while, one stricking advantage should be obvious to you: Consistancy of environments. Think about how many times you have been told by the development team: ‘Oh, but it works in my local Dev enviornment. Something must be wrong in production servers. May be a jar file is missing in the classpath in Prod?’ Painful. Docker puts an end to all this environment specific mysteries.

So, to summarize: Docker is a container solution that enables buliding, shipping and running applications with all the required software in a single unit. The benefits include consistency across deployments, fast startup, flexible and developer-friendly build process.

Enough fluff. Let’s get our hands moving by actually running a Docker container.

Installing Docker

 

Before you can actually run your first Docker Conainter, you have to install Docker software.

What do you need to begin?

A Linux or Windows or MAC system (can be a desktop or a server).

There are two flavors of Docker. Community Edition and Enterprise Edition. Community Edition is free and mainly greared towards learning and testing purposes. Enterprise Edition comes with few bells and whistles and also comes with an invoice in the mail. We will be using Community edition to learn Docker. (Note: You cannot install Docker Enterprise Edition in Desktops). For full compatibility matrix, check this link.

Note: In older MAC and Windows systems, Docker was installed using Docker Toolbox, a legacy desktop solution that inlucded docker-machine, docker and docker-compose commands (more on these commands later). If you have newer MAC ( OS X El Capitan10.11 or later) or Winodws (Winodws 10 or later) It is recommeded to install Docker for MAC or Docker for Windows instead of Docker Toolbox.

MAC

To install Docker for MAC, download the dmg from Get Docker for Mac (Stable).

Double click Docker.dmg. Drag and drop to the Applications folder as shown below.

docker-app-drag

Note: You must have Admin privilege to perform the install, as shown by the pop up below that appears when you run the install

Screen Shot 2018-02-17 at 10.09.09 PM

Once installed, the docker icon (Whale) should appear on your top status bar.

Windows

Download the installer from Get Docker for Windows (Stable).

Simply launch the exe file and follow prompts. It should be a super straight forward install.

Ubuntu

You can use apt-get to install from the Docker repository or install a deb package using dpkg.

Follow the instructions here

CentOS

You can use yum to install from the Docker repository or download rpm from here

For detailed instructions, go here.

Great, now that you’ve installed Docker, let’s start playing with it with some basic commands.

Using Docker for the first time

 

We will be using Docker for Mac to illustrate. The commands are exactly the same in other flavors.

First thing you want to do is to make sure you have the latest version of Docker (at least not some ancient version). As of this writing, Docker CE 17.12.0 is the stable version. Click on the Docker icon (Whale) at the top status bar and click on About Docker

Screen Shot 2018-02-17 at 10.34.39 PM

Open a terminal and type the following command

~$docker version
Client:
 Version: 17.12.0-ce
 API version: 1.35
 Go version: go1.9.2
 Git commit: c97c6d6
 Built: Wed Dec 27 20:03:51 2017
 OS/Arch: darwin/amd64

Server:
 Engine:
 Version: 17.12.0-ce
 API version: 1.35 (minimum version 1.12)
 Go version: go1.9.2
 Git commit: c97c6d6
 Built: Wed Dec 27 20:12:29 2017
 OS/Arch: linux/amd64
 Experimental: false

What is Virtualization?

Virtualization is a technique using which you can run multiple Operating Systems (aka Guest) in a physical server (host) by abstracting (or virtualizing) CPU, Memory, Disk and Network resources. The core component of any virtualization solution is Hypervisor – the software that performs the abstraction of bare metal resources.

Here are the primary benefits of using Virtualization:

  1. Save cost on hardware
  2. Centrally manage the infrastructure
  3. Add effective fault tolerance and high availability
  4. Dynamically update the infrastructure

The diagram below shows virtualization at a high level.

Read More

5 reasons why you can’t afford NOT to Virtualize

The verdict is in. Virtualization is the future. If you are still running your applications on bare metal, you are missing out on tons of benefits, or even hurting your business. Virtualization is a software tech that lets you run multiple operating systems and applications on a physical server by abstracting the hardware underneath. Among several Virtualization software makers, the following are considered leaders:

VMWare (ESXi)

Citrix (XenServer)

Microsoft (Hyper-V)

Let’s dive in to 5 reasons why you can’t afford NOT to virtualize (not necessarily in any order)

Read More

A Quick overview of AWS

AWS (Amazon Web Services) is a leading Cloud services provider. The product (service) offerings from AWS are enormous. For newbies, it may be difficult to understand what each Service is used for. In this short article I will give you a high level overview of the various AWS Services.

Instead of typing pages of information, I’ve compiled and distilled the core information and presented here in a tabular format. In this way, it can also act as a quick reference.

Read More

Buckle up! You can get your own AWS server in cloud. You can run a verity of OS on it, connect to any popular Database you want to and even get your hands on some of the coolest products from AWS. I don’t know about you but I’m psyched about all this.

apm

Yes, Amazon Web Services Free Tier allows you to have your own Server in EC2 for 12 months. If you are new to AWS, this is a great way to get your feet wet, or may be drenched.

This article shows exactly how you sign up and crank up your own server in cloud. It takes about 15 to 20 minutes to get your hands on a brand new Amazon Linux instance (or Windows or Suse or RHEL…..)

Without further due, here are the actual steps to follow.

Read More

It transports 1 petabit/sec with 100,000 servers talking to each other at 10Gbits/sec. Yes it is sick. This is how Google achieved that feat.

It is no brainer. With the amount of data google indexes (last time I checked, it is all the data from a small network called Internet), there is no way traditional Data Centers and Network Infrastructure can deliver. The underpinning technology that makes companies like Google take giant leap in Network design is SDN aka Software Defined Networking.

Read More