Getting started on driftctl: build your own driftctl Docker image

Including your own .driftignore file

This post is the last of the walkthrough series on how to get started on driftctl. For any additional information, feel free to join our discord community server or reach out on GitHub. We’ll be glad to chat.

Easy steps to your driftctl Docker image

The easiest way to use driftctl along with your own custom .driftignore file is to build your own driftctl Docker image, based on the official one.

Requirements for this tutorial:

Here´s how we do it:

  • Now create a new folder (that will eventually become a git repository later) and add your own .driftignore file to it:
  • Add all the content you need into this .driftignore file, like:
  • Now, let’s create our own Docker image from the official one; create a Dockerfile and open it:
  • Add the following content:
  • Now build your custom docker image:
  • Finally run your own docker image of driftctl:

Congratulations! Now you can run driftctl fully isolated in Docker, with your own .driftignore always available. Much easier now to run as a scheduled task or cronjob!

Next steps

The next steps can include:

  • Adding this folder to git, so you can version the .driftignore file and track your improvements over time
  • Pushing the image somewhere central, so it can be easily used by your team
  • Automatically rebuilding your own docker image when the source image changes (so you stay up to date with driftctl)
  • Automatically rebuilding your own docker image when the .driftignore file changes
  • Adding your docker image scan to an hourly cron job so you are notified when something drifts

We’d love to hear about your own use cases, come tell us how you use driftctl! Thanks for reading!

Stay in touch

Get product updates and occasional news.