We recently released the new versions of the BuildKit builder toolkit, Docker Buildx CLI, and Dockerfile frontend for BuildKit (v1.7.0). In this blog

New Dockerfile capabilities in v1.7.0

submited by
Style Pass
2024-04-29 00:00:04

We recently released the new versions of the BuildKit builder toolkit, Docker Buildx CLI, and Dockerfile frontend for BuildKit (v1.7.0). In this blog post, I’ll go over some of the new Dockerfile capabilities and explain how you can start using them in your projects.

While most projects use Dockerfiles to build images, BuildKit is not limited only to that format. BuildKit supports multiple different frontends for defining the build steps for BuildKit to process. Anyone can create these frontends, package them as regular container images, and load them from a registry when you invoke the build.

With the new release, we have published two such images to Docker Hub, docker/dockerfile:1.7.0 and docker/dockerfile:1.7.0-labs.

To use these frontends, you need to specify a #syntax directive at the beginning of the file to tell BuildKit which frontend image to use for the build. Here we have set it to use the latest of the 1.7.x major version.

This means that BuildKit is decoupled from the Dockerfile frontend syntax. You can start using new Dockerfile features right away without having to worry about which BuildKit version you’re using. All the examples described in this post will work with any version of Docker that supports BuildKit (The default builder as of Docker Engine v23), as long as you define the correct #syntax directive on the top of your Dockerfile.

Leave a Comment