dockercon sf 2015: maintaining the official node.js docker image

18
Maintaining the Official Node.js Docker Image Christopher Horrell Manager, Solutions Engineering Joyent Inc., @chorrell

Upload: docker-inc

Post on 05-Aug-2015

1.822 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: DockerCon SF 2015: Maintaining the official node.js docker image

Maintaining the Official Node.js Docker ImageChristopher HorrellManager, Solutions Engineering Joyent Inc., @chorrell

Page 2: DockerCon SF 2015: Maintaining the official node.js docker image

Joyent Inc.• Container company (since ~2006)

• Joyent Public Cloud

• Private Cloud Software, Smart Data Center (https://github.com/joyent/sdc)

Page 3: DockerCon SF 2015: Maintaining the official node.js docker image

• Part of Smart Data Centre and available in Joyent Public Cloud

• Run Docker images natively on SmartOS Zones

• Turns an entire data center into a Docker host

• Or run non-Docker Linux containers at bare-metal speed!

Page 4: DockerCon SF 2015: Maintaining the official node.js docker image

Solutions Engineering• The "image team"

• Core members are myself and Derek Crudgington (https://github.com/dcrudgington)

• Build images for Joyent Public Cloud, Smart Data Center, and SmartOS - SmartOS, KVM Linux (Debian, CentOS)

FreeBSD and Windows Images - Linux (Triton!) Container images

• And maintain the official Docker Node.js Image!

Page 5: DockerCon SF 2015: Maintaining the official node.js docker image

Docker Node.js Image

• The registry: https://registry.hub.docker.com/_/node/

• GitHub: https://github.com/joyent/docker-node

• Kind of popular!

Page 6: DockerCon SF 2015: Maintaining the official node.js docker image

The Hand Off!• Took over an existing official image, which had some

advantages: - Had some great scripts for updating the image - Everything was pretty well established

• Great resources: - https://github.com/docker-library/official-images - IRC channel #docker-library on Freenode

• Some prior history we had to get familiar with: - Choice of base image (buildpack-deps:jessie) balances

general usefulness vs. image size (more on that later) - Different tags/variants (more on those later)

Page 7: DockerCon SF 2015: Maintaining the official node.js docker image

Image Update Workflow• Update image Dockerfiles → Generate

new library file → make pull request to official Library

• The workflow was a bit new for us, but we settled in nicely

• Looking to automate image updates and testing. Some interesting options with Jenkins

Page 8: DockerCon SF 2015: Maintaining the official node.js docker image

Some Additions• Did not want to introduce too much change

to the images

• Derek updated the update.sh and generate-stackbrew-library.sh scripts (now Mac-friendly)

• Added simple build test to ensure all the images build. Test 0

• Looking at using Serverspec for testing and automating things (more on that later)

Page 9: DockerCon SF 2015: Maintaining the official node.js docker image

Are you starting from scratch?• Great resources: Docs, irc channel, other official images

• We had the benefit of taking over an established image which follows Docker best practices

• You need to consider things like: - What base image to use? Use an official base image

(Debian, Ubuntu, CentOS etc), one that makes sense for the overall image.

- Dockerfile best practices

• What Tags and Variants will you have?

• Include Tests! At very least, does it build?

Page 10: DockerCon SF 2015: Maintaining the official node.js docker image

Tags are Great!• Offer different versions:docker pull node:0.10.38docker pull node:0.12.4docker pull node:latest # -> 0.12.4

Page 11: DockerCon SF 2015: Maintaining the official node.js docker image

Variants: Also Great!• docker pull node:0.12.4-slim # A "leaner" version of node:0.12.4docker pull node:0.12.4-wheezy# Alternative if prefer Debian Wheezy over Jessie

• Document your tags and variants • Usage might not be obvious to anyone browsing registry (or GitHub repo)

• Good examples: - https://registry.hub.docker.com/_/node/ - https://registry.hub.docker.com/_/iojs/

Page 12: DockerCon SF 2015: Maintaining the official node.js docker image

Image Size?• Keep the image reasonably small: A balance between size and

usefulness

• node:latest etc. is built from buildpack-deps:jessie - Big, lots of packages installed, makes building things like

npm modules easy. That's super convenient

• node:slim variant (FROM debian:jessie) is a nice option to build on if you know what you want installed and prefer to keep things lean

• Alpine Linux is SUPER small (~5MB!), might probably not be suitable for your app or use case, but worth looking at.

Page 13: DockerCon SF 2015: Maintaining the official node.js docker image

User Feedback• Monitor GitHub issues for user feedback

-- this works pretty well

• GitHub issues are great way for responding to or integrating user feedback

• Consider creating an F.A.Q for recurring GitHub issues about design decisions (like choice of base image, etc.)

Page 14: DockerCon SF 2015: Maintaining the official node.js docker image

Testing• At the very least: Does it build?

• Test Driven Development applied to Dockerfiles/Images: - https://workshop.avatarnewyork.com/post/

test-docker-images-with-circleci/ - http://blog.wercker.com/2013/12/23/Test-

driven-development-for-docker.html - https://workshop.avatarnewyork.com/post/

test-docker-images-with-circleci/

• Continuous Integration with Jenkins?

Page 15: DockerCon SF 2015: Maintaining the official node.js docker image

Serverspec• http://serverspec.org

• Great testing option, based on Rspec

• Been using it to test our SmartOS/KVM images (e.g., https://github.com/joyent/smartos-image-tests)

• Has Docker support! - Create a test suite that builds your image (test 0)

provisions a container, runs test against a container

• Great option to validate your images before publishing

• Speaking of the Docker Node image...

Page 16: DockerCon SF 2015: Maintaining the official node.js docker image

Interesting Plot Twist!

• Node.js and io.js will be merging!

❤️

Page 17: DockerCon SF 2015: Maintaining the official node.js docker image

What will happen to the Node.js image?• Will eventually move under the Node.js foundation (https://

github.com/nodejs/),

• Will be maintained by the Node.js Docker Working Group (I'm a member!)

• The Official io.js and Node.js images will probably track separately until the big merged release

• Working Group is maintaining the Official io.js image, doing a great job, and the Node.js and io.js images are pretty similar (tags, variants, etc.)

• It should be a pretty smooth transition (docker pull node:latest and docker pull node:0.10.38 will still work :)

• Longer term? Still offer older Node.js releases but a lot of things the Working group will need to figure out.

Page 18: DockerCon SF 2015: Maintaining the official node.js docker image

Thank youChristopher [email protected], @chorrell