-
Notifications
You must be signed in to change notification settings - Fork 626
Description
Behavior
Using a fresh buildx docker-container builder, a bake using a (populated) local cache and a build context (i.e. COPY, RUN --mount, etc.) will fail with one of ERROR: failed to solve: Canceled: grpc: the client connection is closing or ERROR: failed to solve: Unavailable: error reading from server: EOF
Desired behavior
The first build with a fresh builder must succeed against a local cache for practical use of the local cache in CI applications. With a builder that has already baked the images, this issue become intermittent. That case should also succeed consistently.
Environment
docker info:
Client:
Context: desktop-linux
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.9.1)
compose: Docker Compose (Docker Inc., v2.10.2)
extension: Manages Docker extensions (Docker Inc., v0.2.9)
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
scan: Docker Scan (Docker Inc., v0.19.0)
Server:
Containers: 13
Running: 4
Paused: 0
Stopped: 9
Images: 59
Server Version: 20.10.17
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: 2
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: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
seccomp
Profile: default
cgroupns
Kernel Version: 5.10.124-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
CPUs: 5
Total Memory: 7.667GiB
Name: docker-desktop
ID: P2BC:5HXV:5ELQ:YK6I:LRNJ:PVRL:FJ76:EZ7P:H2QB:QVXD:ON2C:AUVO
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5000
127.0.0.0/8
Live Restore Enabled: false
Steps to reproduce
Prepare the files (unzip this to skip):
$ mkdir base
$ mkdir layer
$ touch base/Dockerfile
$ touch base/file
$ touch layer/Dockerfile
$ touch images.jsonbase/Dockerfile:
FROM ubuntu as base
RUN sleep 2
COPY file filelayer/Dockerfile:
FROM base_target as layer
RUN sleep 5images.json:
{
"target": {
"common": {
"platforms": [
"linux/amd64"
]
},
"base": {
"context": "base",
"cache-from": [
"type=local,src=../cache/base"
],
"cache-to": [
"type=local,mode=max,dest=../cache/base"
],
"inherits": ["common"],
"tags": [
"base"
]
},
"layer": {
"context": "layer",
"cache-from": [
"type=local,src=../cache/layer"
],
"cache-to": [
"type=local,mode=max,dest=../cache/layer"
],
"contexts": {
"base_target": "target:base"
},
"inherits": ["common"],
"tags": [
"layer"
]
}
}
}Create the builder:
docker buildx create --name container_driver_builder --driver docker-containerPopulate the cache:
docker buildx bake --builder container_driver_builder -f images.json layerFor each subsequent test, remove the builder, recreate it, and rebuild the bake targets:
docker buildx rm container_driver_builder \
&& docker buildx create --name container_driver_builder --driver docker-container \
&& docker buildx bake --builder container_driver_builder -f images.json layerEach such test fails with ERROR: failed to solve: Canceled: grpc: the client connection is closing or ERROR: failed to solve: Unavailable: error reading from server: EOF.