The CTO of Crowdriff has the first of two posts up about building an app with Docker. The post covers how CTO Abhinav Ajgaonkar used Docker as a “replacement for Vagrant when developing a Node app using the Express.js framework.” It further details how the app is designed to “persist session information in Redis using the connect-redismiddleware.” After reviewing Ajgaonkar’s post, I looked around for other examples of developers using Docker to build Node.js apps and I came across a few that I am going to briefly highlight here. Javascript is the most popular programming languages among Docker contributors, according to research by Chris Dawson that InApps will release soon. The breakdown between the use of client and server side JavaScript is unclear but Ajgaonkar’s work is demonstrative of the interest in Node.js app development and Express.js, which provides a set of features for building single, multi-page and hybrid web applications. Express can also be used to build API-based server apps that work with standard HTTP and JSON as the default.

The post is also evidence that people are switching away from Vagrant to Docker because it simplifies the last step: deployment, Dawson said to me in an email. And Dockerfiles manage services with higher level abstractions. For example, a Vagrantfile specifies IP addresses where a Dockerfile uses links which are an abstraction above specific IPs. This makes deployment more generic and loosely coupled. Furthermore, Vagrantfiles manage a VM while Dockerfiles specify a loose set of services and their connections, a much lighter and more flexible abstraction.

Read More:   Chaos Engineering Is Not Just for Ops – InApps 2022

The app Ajgaonkar prepared has three files: a package.jsonserver.js and a .gitignore file, which he set up as follows: nodejsdockerapp The post further explains how server.js pulls in the dependencies and starts an express app, “which is configured to store session information in Redis and exposes a single endpoint that returns a status message as JSON. ” For development, he ran both Node and Redis in the same container and used Dockerfile to configure it. dockerfile Ajgaonkar used Ubuntu, one of the most commonly used base images with Docker. He used the apt-get command to add Python and Redis-server. The Redis server stores session information and Python is used to build the C-extension. Python is required by npm to build the C-extension. aptget The post goes on to explain how to build and run a container in addition to explaining the workings of the run command. It covers how to start Redis in the container itself. Ajgaonkar uses Nodemon to “watch for changes in project files and restarts the server as needed.” Once the server is started with server.js, Nodemon detected the change and started the server. 2014-06-17-Reload The process Ajgaonkar compares to builds described in other blog posts. Here are a few to review:

  • Mark van Holsteijn of Xebia wrote a post earlier this week about using Deis, the new platform-as-a-service, to build a Node.js app that had originally been used on Cloud Foundry.
  • Sean McGary has a tutorial for creating a container that runs a simple NodeJS web server.
  • Luis Elizondo has a post about an environment with Docker, Node.js, MongoDB and Varnish.

An increasing volume of use case for Docker have started to surface. Docker has been lauded for its capabilities and wide use cases. The interest though,  is as much about its technology as the needed shift for more flexible and lightweight services for distributed workloads. Docker reflects that shift and is symbolic of a new breed of services more suited to rapid application development.

Read More:   Update DataStax Unveils an Enterprise Graph Database Built From Cassandra and TitanDB

InApps is a wholly owned subsidiary of Insight Partners, an investor in the following companies mentioned in this article: Docker.