dockerdocker-composedocker-buildkit

How do you enable BuildKit with docker-compose?


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?


Solution

  • 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