Docker Community Forums

Share and learn in the Docker community.

Unit test frameworks for pre-push docker images and containers


(Rmauri) #1

I am responsible for building a forest of docker images and ultimately pushing them to a private repo.

I have some ad-hoc test scripts that I run post docker build and pre docker tag/push, but it is too simple/nasty bash shell scripts.

I found a very small handful of tools - one uses docker-compose with Ruby harness.
We don’t know Ruby and would like test code expressed like in yaml,json,xml or even in go code.
I’d like some static/lint testing of the Dockerfile, some image validation (FROM is correct, number of run levels is not too deep and a simple container based test that connections from the outside world can be expect/asserted on.

I hear that some are putting test code inside their image to be exercised at docker build time and then removed so the image is stripped of the test code. I’m bothered by this. Imagine an image that runs installs and runs a JRE. I don’t want to install a JDK, create an executable jar, test it and then remove all that from the image.

Thanks, Richard