How do you enable BuildKit with docker-compose?

Archimedes Trajano picture Archimedes Trajano · Oct 28, 2019 · Viewed 17.6k times · Source

I tried export DOCKER_BUILDKIT=1 before a docker-compose build command and I did not see the expected BuildKit output. What did I miss?

Answer

BMitch picture BMitch · Nov 18, 2019

Support for BuildKit was just released in docker-compose 1.25.0. To enable:

export DOCKER_BUILDKIT=1 # or configure in daemon.json
export COMPOSE_DOCKER_CLI_BUILD=1

With those variables set in your shell, you can now run docker-compose build using BuildKit.

In windows you can execute in your console:

setx DOCKER_BUILDKIT 1 # or configure in daemon.json
setx COMPOSE_DOCKER_CLI_BUILD 1

after will need restart your console