Review: Getting started with Docker and containers
Submitted by ipesin on November 1, 2017 - 3:38 pm
What makes a good conference so special? With vast amounts of information available virtually on any topic imaginable at a click’s distance, would it not be more efficient to spend time in comfortable home setting learning new technology?
Jérôme Petazzo’s “Getting Started with Docker and Containers” tutorial at LISA17 was a great example of the fact that despite all the online content and self-paced trainings, an outstanding lecturer can pass on a whole lot more information in limited amount of time than you could possibly hope to learn on your own. What is even more important, by listening to a person keen on the topic, you often pick up the same excitement yourself.
That was definitely the case with me. Containers are not a new concept under the sun: OpenVZ container technology is more than a decade old. In 2008, I led an effort at a firm where I worked back then to introduce containers for infrastructure services like LDAP, DNS, NTP, etc. A year ago, a project required simulation of thousands of Puppet nodes and to do so with reasonable resources, I opted for LXC/LXD containers with great success.
Being a long-time container user, however, Docker is something I was missing out on. For some odd reason, projects I have been working on lately do not leverage containers. I decided to catch up on it during LISA17. I did not anticipate how Jérôme’s training would affect me though.
To start, training was packed with outstanding educational approaches. Participants received access to personal cloud Cocker instances. This meant no one needed to litter their laptops with files and binaries, training time was not spent on resolving issues with tools not being correctly installed. There was no wifi collapse, because instances were provisioned ahead of time, and everyone was using low-bandwidth ssh access to work with them.
Next, Jérôme started to explain Docker capabilities and used fidget
for that. This is a well known tool for generating nice renderings of text in ASCII art. I am using this tool to put hostnames or host functions in /etc/motd
, so it is displayed when people log on to machines via ssh
. The demo resonated with me so much, that an idea hatched in my mind how to improve the way I generate these titles for /etc/motd
: a simple web application, that takes a font name and text as parameters and returns rendered ASCII caption. Then I could simply do a curl request during host provisioning or from Puppet and capture the output into /etc/motd
file.
Finally, you hardly can get such a holistic end-to-end explanation and demonstration of container pipeline online – from coding on a developer’s workstation, through the build and test process, to the deployment in production.
My idea of a web app was so burning, that I simply went online during the first break and bought figlet.me domain, then wrote a simple web application in Go which takes parameters in URL and sends rendering back:
$ curl localhost:8080/?text=LISA17
# ### ##### # # #######
# # # # # # ## # #
# # # # # # # #
# # ##### # # # #
# # # ####### # #
# # # # # # # #
####### ### ##### # # ##### #
The only remaining thing was to put knowledge from the training to use and build a container with this application. In the evening I wrote a multistage Dockerfile, pushed it to Docker Hub, and then started it on a Docker host. Just 3 hours of training and not only I was able to set up the whole Docker development pipeline, I wanted to do it!
Now the web service is available for everyone to use (give it a try):
$ curl -d "font=slant" -d "text=USENIX LISA17 San Francisco" http://figlet.me/
__ _______ _______ _______ __ __ _________ ___ ________
/ / / / ___// ____/ | / / _/ |/ / / / / _/ ___// | < /__ /
/ / / /\__ \/ __/ / |/ // / | / / / / / \__ \/ /| | / / / /
/ /_/ /___/ / /___/ /| // / / | / /____/ / ___/ / ___ |/ / / /
\____//____/_____/_/ |_/___//_/|_| /_____/___//____/_/ |_/_/ /_/
_____ ______ _
/ ___/____ _____ / ____/________ _____ _____(_)_____________
\__ \/ __ `/ __ \ / /_ / ___/ __ `/ __ \/ ___/ / ___/ ___/ __ \
___/ / /_/ / / / / / __/ / / / /_/ / / / / /__/ (__ ) /__/ /_/ /
/____/\__,_/_/ /_/ /_/ /_/ \__,_/_/ /_/\___/_/____/\___/\____/
$ curl -d "font=straight" -d "text=USENIX LISA17 San Francisco" figlet.me
__ __ __ ___ __ __
/ \(_ |_ |\ ||\_/ | |(_ /\ /| / (_ _ _ |__ _ _ _. _ _ _
\__/__)|__| \||/ \ |__|__)/--\ | / __)(_|| ) || (_|| )(_|_)(_(_)
Would I do this if I watched YouTube video of a lecture sitting at home? Frankly, I doubt it. And this is why LISA is so special.