Skip to content

A CI/CD pipeline with Docker

Select an icon to see what it is.

Step 2 of 6

Build the image and test it

The runner builds the image and tags it with the commit id, registry.example.com/shop/web:3f9a1c2. It then starts a container from that exact image to run the tests. Testing the image you will ship, not just the source, catches problems in the Dockerfile too.

$ docker build -t registry.example.com/shop/web:3f9a1c2 .

Commands on the runner

docker build -t registry.example.com/shop/web:3f9a1c2 .
docker run --rm registry.example.com/shop/web:3f9a1c2 <test command>
a non-zero exit code fails the job