Deploy Nodejs with Docker & CoreOS

Edwin Fuquen


  • A tool to conveniently manage containers.
  • Containers share the same kernel of the host, but have different filesystems.
  • Like lightweight VMs.
  • The power of docker is the creation of lightweight, consistent, and easily shareable environments for running applications.


  • Is a build scripts
  • Each line is a layer
  • Layers build on top of each other successively
  • Similar to git commits


  • Linux OS based on Chrome OS, which itself is based on Gentoo.
  • There is no package manager, and only a few preinstalled tools.
  • The most essential being docker, etcd, & fleetd.
  • An OS fully built around managing containers in a distributed, fault tolerant cluster of machines.
  • A distributed key/value store.
  • Meant for config data, not high latency/throughput.
  • Strongly consistent, very reliable.
  • Think zookeeper replacement.


  • Uses etcd to make a distributed init system.
  • Essential runs systemd services on nodes.
  • Feed in standard systemd unit files.
  • But with some optional Fleet metadata.

Service Unit File


ExecStartPre=/usr/bin/docker pull progrium/registrator:master
ExecStart=/bin/sh -c "docker run \
  --name %p.%i \
  -v /var/run/docker.sock:/tmp/docker.sock \
  progrium/registrator:master -ip $COREOS_PRIVATE_IPV4 \
ExecStop=/usr/bin/docker rm -f %p.%i


Service Discovery

  • App ip & port are registered in etcd.
  • confd gets notified when certain keys in etcd are modified
  • Then haproxy.cfg templates get updated with added or removed app ip & port.

Build & Deploy

Docker Issues

  • Daemon can leak memory.
  • Docker builds can take a long time, lots of data.
  • Docker pulls not verified.
  • Containers don't persist.


  • Don't log lots of data to stdout & stderr.
  • Use smaller base images (i.e. debian & busybox).
  • Follow image building best practices.
  • Use an internal registry.
  • Use data only containers for db's (still annoying).

CoreOS Issues

  • Hard to install custom tools on the host.
  • BTRFS has many maintenance issues.
  • Docker has issues playing nice with systemd (mostly an issue with the docker daemon).


  • Use privileged throwaway containers for ops work.
  • Automate BTRFS cleanup/maintenance (and ext4 is in Alpha).
  • systemd-docker: good writeup on the issue here.
  • Rocket ... ?


  • New media site, establishing publishing platform.
  • We're Hiring!
  • Software Developer & Data Science roles

ScriptEd >_

  • Nonprofit puts developers in NYC high schools and provides paid summer internships.
  • March 4 - NYC Tech Community Engagement Event.
  • Contact


Copy of NodeJS, Docker, & CoreOS

By Miroslav Kubásek

Copy of NodeJS, Docker, & CoreOS

  • 1,090