Arun Gupta gave his third session on the virtual JUG this week, making him the speaker with most vJUG appearances since it was created back in Nov 2013. This time Arun discussed containers, specifically Docker containers and what they actually are, how they can help and also what’s missing in the Docker tool set today. You should join the vJUG by the way, it’s life changing and will make you a better person #fact.
Here’s the vJUG session if you wanted to watch it back in full:
What is Docker?
Docker is a company backed by an open source project of the same name. It’s a strongly supported project that has has a fast adoption over the last year or so.
People are familiar with the Java WORA premise, that you write once, run anywhere. Arun used the terminology PODA, Package Once Deploy anywhere. The idea is you package your environment as a docker image once and then run as a docker container in many different places.
So, why use Docker?
Of the advantages of using Docker that Arun went through, the 4 biggest ones I took away were the following:
- Faster deployments
I actually really liked the sharing aspect here. Once you create your docker script, or Dockerfile (the default name for your docker configuration) you can upload to a public registry, called the DockerHub, a public SaaS. Note that there is no verification done to images that are uploaded or downloaded to the DockerHub.
So, while using a public registry may be ok for some, you can also create your own private registries, behind your own firewall. Red Hat for example does just this, and you could too. For instance, Artifactory by JFrog can act as a full-fledged local Docker registry, so if you have trust requirements for your project you can easy do everything in-house.
The Docker Implementation
Stop wasting my time, let’s see it!
Here’s an example docker file:
FROM fedora:latest CMD echo "Hello, World!"
These very simple two lines will perform two tasks. Firstly it will grab the latest fedora image, which is actually on the DockerHub and run the second command, printing out “Hello, World!”
Arun went into more depth to run a WildFly server in a docker container. The docker image contained setting to download a JDK, set environment variables and much more. Arun uses this base image and uses a curl command to drop an application onto the server. You may expect this kind of image to take a few minutes to run, but it actually takes seconds.
Check out the full video for much more in depth examples including how to split the application server and database up into separate containers and link them up so that they can interact.
As the video progresses it becomes clear that it’s a fairly manual process if you wanted to create multiple containers and link them together in any kind of predictable way. This leads Arun on to talk about Kubernetes, a Google led open source project that really adds a level of QoS onto the Docker base. Kubernetes provides a self healing and auto restarting environment that simply asks you for your desired state. For example if you want 5 WildFly servers, 2 SQL dbs, you ask for that many to be created and Kubernetes will try to maintain that many instances for you. If you want to replicate the environment, you can, it just duplicates the environment, like using a cookie cutter – om nom nom.
The Docker runtime, introduces pods, a Kubernetes scope that can contain Docker containers. You can also have services which act as a front end for pods and can be load balancers for pods, and as such, docker containers.
There’s a bunch more to learn and I could write blog post after blog post on the topic! Watch the session in full as it’s a real eye-opener to the world of containers. Below is the slide deck which Arun uses during the session.
Exclusive RebelLabs Interview
Oh and Oleg, your friendly head of RebelLabs, caught up with Arun straight after the session for a quick 12 minute interview. Who would have thought Arun would not have a preference over kittens or puppies?! For this and more, check out the exclusive interview below:
Wasn’t that a great blog and video? At this point you’re grabbing your monitor/laptop screaming “HOW DO I GET MOAR??“. Well, it’s easy, subscribe to our newsletter using an amazingly convenient form below. We’ll do our best to make you catch up with everything important!