Category: ansible, Docker

We will take a look on how to build Docker images and take notes about building time, resulting image size and files sent to the build context. Our target is to build a Linux Docker Container with Ansible and AWS CLI installed. We have the following project file tree: We have a Dockerfile with our container specs, a .dockerignore to exclude files from build context and files to be copied into the target container.

Take note of the --no-cache to prevent caching, as we want to meassure the time it takes to build the image.

Now we have the following Dockerfile: We still use python:3.9.1-buster as base for our image to install Ansible and AWS CLI.

Related Articles