tocker
is a plugin for testinfra that allows developers to test docker
images
pip install tocker
Set your environment variables to connect to docker engine:
export DOCKER_HOST=unix:///var/run/docker.sock
If docker engine runs a different host, set the following:
export DOCKER_TLS_VERIFY=1
export DOCKER_HOST=tcp://ip:port
export DOCKER_CERT_PATH=/path/to/certs
If you're using docker-machine
, you can simply run:
eval $(docker-machine env myenv)
Dockerfile
test.py
in the same directoryIMAGE_TAG
to test.py. E.g: mycorp/nginx:1.9.12
testinfra test.py
(-s -v
for verbose mode)Dockerfile
until the tests passdocker push
the imagetocker
builds an image from Dockerfile
IMAGE_TAG
docker exec
tocker
uses docker build cache so the consecutive runs are fastIf you're looking to add a new module, please contribute to testinfra.
If it's more specific to Docker
, you can add additional fixtures under tocker/fixtures.py
. Pull requests are welcome.