buildx: no active session for : context deadline exceeded

I’m seeing buildx error like this:

#25 exporting to image
#25 exporting layers
#25 exporting layers 2.4s done
#25 exporting manifest sha256:bee6a0ade00b7bc2bcaae86deefc8e88e6a274dee097c8ade078e4b3a88de520 done
#25 exporting config sha256:ac3b1fe36ac072dafadc6f2aed84ff305d810a92a3e62f71a820928c832d9ac9
#25 exporting config sha256:ac3b1fe36ac072dafadc6f2aed84ff305d810a92a3e62f71a820928c832d9ac9 0.0s done
#25 exporting manifest sha256:b7812799f180bbded0a8de865efba29dcf351c858f958e506cc13e612657e4b8 0.0s done
#25 exporting config sha256:b7efbce252b10357c495758cfb1299a4c6908153eec71fc8e3097bcca5d3eb8f done
#25 exporting manifest list sha256:cbf719abf8d8c678350283152e91f9f49c1138e0087758eeaa67f6697ae4dfda done
#25 ERROR: no active session for os44n22472jqaz3bk2t3jktq2: context deadline exceeded

Things to note:

  • buildx v0.4.2
  • build takes 4h50m
  • it’s meant to push to quay.io
  • full build log

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 40 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Hi everyone!

I add before " Build and push " step.

  - name: Pre Build
    run: "docker system prune -af"

or

  - name: Pre Build
    run: "docker system prune --volume -af"

It works for me.

@Oliveirakun Temporary solutions can be used…

export DOCKER_BUILDKIT=1
for i in $(seq 1 3); do
  if docker buildx build --platform linux/amd64,linux/arm64 -t test:dev . --push; then
    break
  fi
  sleep 3
  if [[ "${i}" == "3" ]]; then
    echo "[Error]: build error"
    exit 1
  fi
done

Add retry mechanism…

This also happens with short build times, in this case less than 10 minues. Often the same build passes with a build time of about 12 minutes. I’d say it fails in about 50 % of the jobs.

#9 DONE 528.6s
#10 exporting to image
#10 exporting layers
#10 exporting layers 10.6s done
#10 exporting manifest sha256:e341e2c0bc3510d62cc7650f3ee0e5006bb679499977832fc8a6b493d5dc8491
#10 exporting manifest sha256:e341e2c0bc3510d62cc7650f3ee0e5006bb679499977832fc8a6b493d5dc8491 0.4s done
#10 exporting config sha256:082f6382fb3047e7182df5bf0360c2cf5b9927b4b4fd8664ad058c75663bc485
#10 exporting config sha256:082f6382fb3047e7182df5bf0360c2cf5b9927b4b4fd8664ad058c75663bc485 0.4s done
#10 ERROR: no active session for 7c6uxna8fa27v8oanfq8zcj3l: context deadline exceeded
------
 > exporting to image:
------
failed to solve: rpc error: code = Unknown desc = no active session for 7c6uxna8fa27v8oanfq8zcj3l: context deadline exceeded
Cleaning up file based variables 00:00
ERROR: Job failed: exit status 1

buu700 commented on Jan 24

I’ve been consistently running into this with Docker for Mac 4.4.2 on my M1 MacBook Air, specifically when building a Dockerfile with a COPY instruction. Downgrading to 4.3.2 seems to have fixed the problem.

I confirmed that this is still an issue in version 4.9.1, this time testing on x86 macOS. As before, downgrading to 4.3.2 is an effective workaround.

I’ve been trying to figure out why I get this dreaded error when doing a few concurrent DOCKER_BUILDKIT=1 docker build(x) builds:

failed to solve with frontend dockerfile.v0: failed to read dockerfile: no active session for kqupcokbxys31oapli62ax81k: context deadline exceeded

Btw I don’t get the error when DOCKER_HOST is blank. Only get it when using DOCKER_HOST=ssh://docker.example.com. I’m on that server docker.example.com (passwordless ssh is configured and working).

Anyway I saw this closed bug and figure it’s been fixed for so long I must have the fix, but my docker 20.10.14 on ubuntu 20 still uses buildx: Docker Buildx (Docker Inc., v0.8.1-docker)! Why is it so old? Is there any way to upgrade it?

Still have it on Buildkit: moby/buildkit:v0.9.0-rootless, Azure Kubernetes service, Azure Container service

In my case was related to 2 concurrent cache exports:

2021-08-24T12:19:53.5930996Z #26 exporting cache 2021-08-24T12:19:53.5931582Z #26 sha256:2700d4ef94dee473593c5c614b55b2dedcca7893909811a8f2b48291a1f581e4 2021-08-24T12:19:53.5931959Z #26 preparing build cache for export 2021-08-24T12:19:54.1934009Z #26 preparing build cache for export 0.5s done 2021-08-24T12:19:54.1934497Z #26 writing layer sha256:0da622ee6d9e9d6172a4eb7e3647a200f74190536a9c3b8b53a9c2d014803b7d 2021-08-24T12:20:14.4543178Z #26 20.95 error: no active session for aim388ulrmif949ccgd2k0xza: context deadline exceeded 2021-08-24T12:20:14.4543633Z #26 20.95 retrying in 1s 2021-08-24T12:20:44.4583718Z #26 50.95 error: no active session for aim388ulrmif949ccgd2k0xza: context deadline exceeded 2021-08-24T12:20:44.4584324Z #26 50.95 retrying in 2s 2021-08-24T12:20:59.4693657Z #26 65.96 error: no active session for aim388ulrmif949ccgd2k0xza: context deadline exceeded 2021-08-24T12:20:59.4694097Z #26 65.96 retrying in 4s 2021-08-24T12:21:09.4759423Z #26 writing layer sha256:0da622ee6d9e9d6172a4eb7e3647a200f74190536a9c3b8b53a9c2d014803b7d 75.4s done 2021-08-24T12:21:09.4760392Z #26 75.97 error: no active session for aim388ulrmif949ccgd2k0xza: context deadline exceeded 2021-08-24T12:21:09.4760992Z #26 ERROR: error writing layer blob: no active session for aim388ulrmif949ccgd2k0xza: context deadline exceeded

2021-08-24T12:19:39.0062856Z #43 exporting cache 2021-08-24T12:19:39.0063170Z #43 sha256:2700d4ef94dee473593c5c614b55b2dedcca7893909811a8f2b48291a1f581e4 2021-08-24T12:19:39.0063480Z #43 preparing build cache for export 2021-08-24T12:19:39.4326968Z #43 preparing build cache for export 0.5s done 2021-08-24T12:19:39.5829077Z #43 writing layer sha256:0da622ee6d9e9d6172a4eb7e3647a200f74190536a9c3b8b53a9c2d014803b7d 2021-08-24T12:19:54.4506394Z #43 15.50 error: no active session for aim388ulrmif949ccgd2k0xza: context deadline exceeded 2021-08-24T12:19:54.4506870Z #43 15.50 retrying in 1s 2021-08-24T12:20:24.4557915Z #43 45.50 error: no active session for aim388ulrmif949ccgd2k0xza: context deadline exceeded 2021-08-24T12:20:24.4558485Z #43 45.50 retrying in 2s 2021-08-24T12:20:54.4602936Z #43 75.51 error: no active session for aim388ulrmif949ccgd2k0xza: context deadline exceeded 2021-08-24T12:20:54.4604240Z #43 75.51 retrying in 4s 2021-08-24T12:21:04.4717026Z #43 writing layer sha256:0da622ee6d9e9d6172a4eb7e3647a200f74190536a9c3b8b53a9c2d014803b7d 85.0s done 2021-08-24T12:21:04.4717958Z #43 85.52 error: no active session for aim388ulrmif949ccgd2k0xza: context deadline exceeded 2021-08-24T12:21:04.4718705Z #43 ERROR: error writing layer blob: no active session for aim388ulrmif949ccgd2k0xza: context deadline exceeded

Guys I have stopped seeing the problem after update to Buildkit: moby/buildkit:v0.9.0-rootless and increasing cache size from default to 50 GB ( --oci-worker-gc-keepstorage=50000)