compose: docker compose does not use current buildkit builder
Description
docker compose build
does not use the current buildkit builder. both docker build
and docker-compose build
use this builder, which I need because it contains cache mount data needed for a particularly slow npm ci
command.
Steps to reproduce the issue:
docker buildx create --name cacheable --use
docker buildx inspect --bootstrap
docker compose build <service_name>
Describe the results you received:
The build runs and completes successfully, but does not use my currently selected builder. This can be identified by (a) the slow build and (b) if the builder is stopped beforehand with docker stop buildx_buildkit_cacheable0
then it is still stopped after the build completes.
Describe the results you expected:
I expect docker compose build
to use my current buildkit builder, named buildx_buildkit_cacheable0
Additional information you deem important (e.g. issue happens only occasionally):
Both docker build
and docker-compose build
will start the currently selected builder container (if stopped) and use it to build, which leads me to believe this might be a bug in docker compose
.
Environment contains these vars:
COMPOSE_DOCKER_CLI_BUILD=1
DOCKER_BUILDKIT=1
I have tried setting BUILDKIT_HOST=docker-container://buildx_buildkit_cacheable0
without any change in the behaviour of docker compose build
.
Output of docker version
:
Client: Docker Engine - Community
Cloud integration: 1.0.17
Version: 20.10.6
API version: 1.41
Go version: go1.13.15
Git commit: 370c289
Built: Fri Apr 9 22:46:38 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.6
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 8728dd2
Built: Fri Apr 9 22:44:49 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.4
GitCommit: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
runc:
Version: 1.0.0-rc93
GitCommit: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Output of docker context show
:
You can also run docker context inspect context-name
to give us more details but don’t forget to remove sensitive content.
default
Output of docker info
:
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
compose: Docker Compose (Docker Inc., 2.0.0-beta.3)
scan: Docker Scan (Docker Inc., v0.7.0)
Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 2
Server Version: 20.10.6
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
Default Runtime: runc
Init Binary: docker-init
containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.11.0-22-generic
Operating System: Ubuntu 21.04
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.24GiB
Name: W540
ID: QNQR:7RST:WACE:AHDH:E6OR:II4B:QFD6:B7LR:K3I3:4VDE:3VPD:ZZI3
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: strophy
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details (AWS ECS, Azure ACI, local, etc.): local
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 19
This should still be open - it looks like it’s ideally fixed by https://github.com/docker/compose/pull/9466
Still needed and a PR waiting for review https://github.com/docker/compose/pull/9466
Looks like copying the necessary logic from buildx resolves this https://github.com/docker/compose/pull/9466 🎉