-
install
goss
curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.7/goss-linux-amd64 -o /usr/local/bin/goss curl -L https://raw.githubusercontent.com/aelsabbahy/goss/master/extras/dgoss/dgoss -o /usr/local/bin/dgoss chmod +rx /usr/local/bin/dgoss
-
add the following line to your
~/.profile
or.zshrc
export GOSS_PATH=/usr/local/bin/goss
-
within the directory that contains your
Dockerfile
(where you want to create agoss.yml
with tests) rundgoss edit -p 8080:80 <IMAGE NAME>
-
add some checks with
goss a ...
and quit the editor withexit
goss a port 80 goss a http http://localhost exit
-
run the tests against the container with
dgoss run <IMAGE NAME>
-
Create a Docker image that contains the
docker
binaryFROM ... RUN apt-get update RUN apt-get -y install docker.io ENV GOSS_PATH="/usr/local/bin/goss" ENV GOSS_FILES_STRATEGY="cp"
-
Start a container and mount the docker socket and install
docker
binarymkdir /tmp/docker docker run -it -v /var/run/docker.sock:/var/run/docker.sock - /tmp/docker:/tmp <IMAGE NAME>
- https://github.com/aelsabbahy/goss
- https://medium.com/@aelsabbahy/tutorial-how-to-test-your-docker-image-in-half-a-second-bbd13e06a4a9
- container testing à la Google https://opensource.googleblog.com/2018/01/container-structure-tests-unit-tests.html
- Bazel https://www.bazel.build/
- Bazel for Docker https://github.com/bazelbuild/rules_docker
-
https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes
-
tini - A tiny but valid init for containers https://github.com/krallin/tini
-
Play with Docker Classroom http://training.play-with-docker.com/