A Dockerfile both describes a Docker image as well as layers for the working directory, environment variables, ports, entrypoint commands, and other important interfaces.
Test-Driven Design should drive a developer toward implementation details, not the other way around.
A devops without tests is a sad devops indeed.
Working toward a docker based development environment, my first thoughts were toward Serverspec by Gosuke Miayshita, as it is entirely framework agnostic. Gosuke gave an excellent presentation at ChefConf this year re-inforcing that Serverspec is not a chef centric tool, and works quite well in conjunction with other configuration management tools.
With Docker 1.3 and later, there is a “docker exec” interactive docker API for allowing live sessions on processes spawned in the same process namespace as a running container, effectively allowing external access into a running docker container using only the docker API.
Looking into the docker-api source, there is no support yet for docker 1.3’s exec API interface to run Serverspec tests against the contents of a running docker container.
Attempting even the most basic docker API calls with docker-api, issue 202 made it apparent that TLS support for boot2docker would need to be addressed first.
Here is my functional
spec_helper.rb with the fixes necessary to use docker-api without modifications:
Following this, I can drive the generation of a Dockerfile with a spec:
This drives me iteratively to write a Dockerfile that looks like:
Next step: extend docker-api to support exec for serverspec based testing of actual docker image contents.