Highly available Kafka cluster in Docker

Apache Kafka cluster in Docker

Up until now we’ve been experimenting with Apache Kafka, a tool build with cluster and high availability in mind, but using exactly one host and availability settings which only few very optimistic people would call high.

Not today.

Today we’re going to spin up multi-host Kafka cluster and we’ll replicate topic in it, so if one host goes down, data and its availability won’t suffer.

Continue reading “Highly available Kafka cluster in Docker”

Quick intro to Windows containers

Windows containers

It finally happened. With release of Windows Server 2016 you can run Docker containers with Windows inside. There’s no Virtual Machine hiding somewhere in order for that to happen, or some sort of Windows emulation built on top of Linux core. It’s true Windows in true Docker, which supports Dockerfiles, docker-compose and other docker-goodies. Continue reading “Quick intro to Windows containers”

Using ZeroMQ with Docker

ZeroMQ, Node.js and Docker

Last time we built three client-server Node.js apps that were talking to each other using ZeroMQ. However, running both client and server on localhost is a little bit lame. Let’s put them into containers! They’ll still be lame, but now with Docker around.

So, here’s the plan: let’s see what we need to do to last week’s fire-and-forget ZeroMQ app, so its client and server can work and communicate from within Docker containers. Continue reading “Using ZeroMQ with Docker”

Quick intro to docker-compose

What is docker-compose

docker-compose logoLike docker itself allows managing single container, docker-compose makes it easy to control not just one, but all containers that make distributed app. This includes containers, networks, volumes and all related settings.

If you think about it, starting an app that has more than one container is less than trivial task and it gets exponentially harder as you add more or them. Let’s check out simple example: distributed web-application that consists of two containers – one with web content and one with database.

Continue reading “Quick intro to docker-compose”

Communication between Docker containers

Having an app running from within Docker container is fun, that’s for sure. But do you know what would be even more fun? Many apps running from within containers and talking to each other. Imagine that after playing enough with microservices, you finally decided to split some real monolithic web application into:

  1. container, serving static web content, and
  2. container, serving data through some sort of RESTful API.

First container opens 80th port and, while serving html/css/js by himself, talks to the second container when data request comes.

Communicating containers

So idea is simple, but there’s one thing. How exactly those containers will communicate? How do they even find each other?

Continue reading “Communication between Docker containers”

3 ways to dockerize existing Node.js app

Dockerize all the thingsImagine you have Node.js app you would like to run from within Docker container. Maybe you want to check if it still works on ‘another’ machine, or it’s a test run before adopting containers as the way of software delivery. Reasons may vary.

In order to have something tangible, let’s pick hello.js app which prints out ubiquitous ‘Hello World’:

localhost-hello
How do we put it into container? Continue reading “3 ways to dockerize existing Node.js app”

Quick intro to Docker

What’s Docker.

dockerOn the surface Docker looks like another virtual machine (VM). Just pick Ubuntu image with hello-world app inside, type docker run ubuntu hello-world  in your terminal of choice, and hello-world will start, thinking it owns a whole machine running Ubuntu.

But Docker is not a VM, manager of VMs, or hypervisor of any kind. Docker is a platform for creating, launching and managing containers. Those looks like VMs, quack like VMs, but are much closer to a fence with a barbwire on top of it. No app can enter, no app can leave. What is bad for humans works great for applications in production environment.

Because Docker doesn’t have to deal with guest operating system and hardware abstraction, it can work with the speed that VMs can only dream of, while doing quite similar job. Continue reading “Quick intro to Docker”