How to Docker Workshop, Step-by-Step

Dimitris Kapanidis
Harbur Cloud Solutions
5 min readJul 29, 2014

--

Last week we did the 2nd docker meetup here at Barcelona and the interest was amazingly high! Let me layout some numbers: First event we had 55 signups and 25 attendees. On second event we had 165 signups and 70 attendees, oh and the event was already filled 3 days after being published. This shows that Docker is getting a lot of traction.

On this event, we wanted to focus on something more hands-on than a simple docker intro or a presentation of a tool that uses docker. We wanted real-case scenarios from scratch to deployment, something everyone can understand, but also show the real potential of docker on complex scenarios. The event was split in two phases, Workshop and Lightning Talks.

The first phase is focused on building and deploying a static web-site, and around this process show the basics of docker.

The second phase contains talks about integration with Vagrant, Project Atomic and Docker Patterns.

Below we’ll explain the steps taken to create the workshop, the material presented, and some conclusions about the experience.

Preparations

In order to make the workshop as smooth as possible I needed to make some preparations before that. First of all, I sent an email to all attendees in order to get some steps warmed up, before starting the event. The advantage with Docker is that given very few requirements (e.g. install docker) you can get started an environment were you can build on-top of, and this applies very well to workshops.

The first step was to make sure that latest Docker version is installed appropriately:

docker version

then, make sure the necessary images are cached locally. This is really important, otherwise during the workshop the wifi would be insufficient for everyone to download the images:

docker pull ubuntu docker pull nginx

Clone the Docker Workshop repository. The Repository contains all the commands and the necessary files to execute them. Basically the repo is self-sufficient and can be followed / executed at any machine with docker installed:

git clone https://github.com/harbur/docker-workshop

And finally, login to the workshop Chat room. The chat room is a good way to centralize communication during the workshop and make the event more interactive. Also people could resolve issues by asking inside the chat room, and getting help from the rest.

Intro

We started the workshop with a basic Intro of what is Docker as a concept and how it is superior compared to Virtual Machines. Another important concept is the separation of concerns that was also explained, separating the two processes of developing and shipping the app. Below you can see the intro presentation:

We didn’t spend much time on the introduction as this was more hands-on event, so we rushed directly to the code.

CLI Basics

At this section of the workshop we started with the basics of using the command line to launch containers. The first example was a simple “Hello World” container that prints the text and exits. The second one was an interactive container were you’re given a shell inside the container and can look around. Other examples cover pipelining, searching containers and exposing ports. Last example and most interesting was to launch a nginx container with a volume mount and expose the port outside. The result of the command was a “Hello World” static site (where the index.html was mounted from the repository)

At the end, a 10min session was given so that each one can create their own static site and publish their url through the chat room. Here is the result of some inspiring websites built during the workshop:

Dockerfile Basics

During the Dockerfile section we started with building a container manually and commiting it as image, then repeated the process with a Dockerfile to automate it. First we built a Git client then an Apache server.

Lastly, we built a static website using a parent image (nginx) and added our static site inside the container. Another session was given so that each one can build their own sites as images and run them locally.

As extra step, a private registry was launched for the workshop and people could share their images by pushing/pulling their images at the registry (Though we skipped this part to continue with the talks)

Talks

After the workshop we had three talks:

  • Vagrant & Docker
  • Docker Patterns
  • Project Atomic

Vagrant & Docker

The first talk was presented by Nicolas Poggi and is about Vagrant & Docker provider:

Docker Patterns

The second talk presented by me from Harbur, is focused on the possible abstraction patterns that emerge with docker, specifically we talked about:

This talk was an intro of those patterns followed by actual demo-examples of each pattern. Those examples can be found at the github repo under Docker Patterns section.

Project Atomic

Last talk was presented by Pep Turró Mauri from Redhat, and is about Project Atomic, a lightweight OS optimized to host Docker containers.

You can see his presentation here:

http://revel-tams.rhcloud.com/atomic.html

Summing up

It was very interesting experience the organization of Docker Workshop. More of these events will follow, since there are a lot of people that would like to come but couldn’t or there were no slots available.

Originally published at blog.harbur.io on July 29, 2014.

--

--