for-win
for-win copied to clipboard
Canceled: context cancelled while "load build context"
Description
Cannot run docker compose with building images (but I also have similar project that works fine). Definition in docker-compose.yml:
services:
app-c:
build:
context: .
target: app-c
Of course this is simplified definition, but there is nothing abnormal. Dockerfile contains several multistage instructions. I'm not touching any key :) Output:
[+] Building 1.6s (8/46) docker:default
=> [app-c internal] load .dockerignore 0.0s
=> => transferring context: 161B 0.0s
=> [app-c internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 13.36kB 0.0s
=> [app-c internal] load metadata for docker.io/library/composer:latest 0.6s
=> [app-c internal] load metadata for docker.io/library/php:8.2-cli 0.5s
=> [app-c] FROM docker.io/library/composer:latest@sha256:0ec8a8f72dbd9bdc7e51ba5c0be475520fda1bbef8b9df521fd18ddb1d7d6216 0.0s
=> CACHED [app-c php-app-env 1/10] FROM docker.io/library/php:8.2-cli@sha256:fcf36572f8c4fa59a5d3ba06ff5cc780c819c51d9d1e34 0.0s
=> CANCELED [app-c internal] load build context 0.8s
=> => transferring context: 14.42MB 0.7s
=> CANCELED [app-c dpp-cli 2/19] RUN apt-get update && apt-get install -y ... 0.9s
failed to solve: Canceled: context canceled
Self-diagnose tool does not found any errors
Reproduce
docker compose up --build
Expected behavior
Docker should build and start normally
docker version
Client:
Cloud integration: v1.0.35+desktop.5
Version: 24.0.6
API version: 1.43
Go version: go1.20.7
Git commit: ed223bc
Built: Mon Sep 4 12:32:48 2023
OS/Arch: windows/amd64
Context: default
Server: Docker Desktop 4.25.2 (129061)
Engine:
Version: 24.0.6
API version: 1.43 (minimum version 1.12)
Go version: go1.20.7
Git commit: 1a79695
Built: Mon Sep 4 12:32:16 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.22
GitCommit: 8165feabfdfe38c65b599c4993d227328c231fca
runc:
Version: 1.1.8
GitCommit: v1.1.8-0-g82f18fe
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
Client:
Version: 24.0.6
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.11.2-desktop.5
Path: C:\Program Files\Docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.23.0-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-compose.exe
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.0
Path: C:\Program Files\Docker\cli-plugins\docker-dev.exe
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.20
Path: C:\Program Files\Docker\cli-plugins\docker-extension.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v0.1.0-beta.9
Path: C:\Program Files\Docker\cli-plugins\docker-init.exe
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: C:\Program Files\Docker\cli-plugins\docker-sbom.exe
scan: Docker Scan (Docker Inc.)
Version: v0.26.0
Path: C:\Program Files\Docker\cli-plugins\docker-scan.exe
scout: Docker Scout (Docker Inc.)
Version: v1.0.9
Path: C:\Program Files\Docker\cli-plugins\docker-scout.exe
Server:
Containers: 14
Running: 3
Paused: 0
Stopped: 11
Images: 69
Server Version: 24.0.6
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
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: active
NodeID: wvknu5g69lfa2jaudfbsarsm5
Is Manager: true
ClusterID: r30s4ucqsqgaedtmkfr2fah0q
Managers: 1
Nodes: 1
Default Address Pool: 10.0.0.0/8
SubnetSize: 24
Data Path Port: 4789
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 10
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Autolock Managers: false
Root Rotation In Progress: false
Node Address: 192.168.65.4
Manager Addresses:
192.168.65.4:2377
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
runc version: v1.1.8-0-g82f18fe
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
Kernel Version: 5.15.133.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 20
Total Memory: 15.46GiB
Name: ACPC829
ID: 78a01d92-d5ad-4ee1-ba95-dbd32bbca631
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
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile
Diagnostics ID
72930303-7115-4BA1-91B9-A784121E78E8/20231128113933
Additional Info
Windows 11, Docker desktop v4.25.2
I figure this problem came in recent versions of docker.
I'm having this same problem on Docker Desktop 4.26.1 on Windows 11, I found a thread that said to downgrade to Docker Desktop 4.22 and that fixed the problem. So it is a problem with the never versions of docker like @randercarlos said. I tried installing Docker Desktop 4.23 and the problem came back. So the bug was introduced in 4.23.
ERROR:
#12 [frontend internal] load .dockerignore
#12 DONE 0.0s
#13 [frontend internal] load build definition from Dockerfile.frontend
#13 transferring dockerfile: 155B done
#13 DONE 0.1s
#12 [frontend internal] load .dockerignore
#12 transferring context: 2B done
#12 DONE 0.1s
#14 [frontend internal] load metadata for docker.io/library/node:21.5.0
#14 ...
#15 [frontend auth] library/node:pull token for registry-1.docker.io
#15 DONE 0.0s
#14 [frontend internal] load metadata for docker.io/library/node:21.5.0
#14 DONE 1.4s
#16 [frontend 1/5] FROM docker.io/library/node:21.5.0@sha256:73a9c498369c6e6f864359979c8f4895f28323c07411605e6c870d696a0143fa
#16 resolve docker.io/library/node:21.5.0@sha256:73a9c498369c6e6f864359979c8f4895f28323c07411605e6c870d696a0143fa 0.0s done
#16 sha256:b632a1ec41a0927d19a432c525641b9a4451251d0b0b63f1d764810a562ea4e1 2.00kB / 2.00kB done
#16 sha256:b678102cb2bf5d132e7c474e4f0fecea2a93586e6ad97ee526cc68e0be5b3178 7.52kB / 7.52kB done
#16 sha256:73a9c498369c6e6f864359979c8f4895f28323c07411605e6c870d696a0143fa 1.21kB / 1.21kB done
#16 CANCELED
#17 [frontend internal] load build context
#17 transferring context: 3.47MB 0.1s done
#17 CANCELED
failed to solve: Canceled: context canceled
exit status 17
compose-dev.yaml:
services:
database:
image: postgres:16.1
container_name: database
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
ports:
- 5432:5432
volumes:
- ./database:/var/lib/postgresql/data
restart: always
backend:
image: docker/python:latest
build:
context: ./backend
dockerfile: Dockerfile.backend
container_name: backend
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
ports:
- 8000:8000
volumes:
- ./backend:/app
working_dir: /app
depends_on:
- database
frontend:
image: docker/node:latest
build:
context: ./frontend
dockerfile: Dockerfile.frontend
container_name: frontend
command: npm run dev
ports:
- 3000:3000
volumes:
- ./frontend:/app
working_dir: /app
depends_on:
- backend
Dockerfile.frontend:
FROM node:21.5.0
WORKDIR /app
COPY ./package.json ./
RUN npm install
COPY . ./
CMD ["npm", "run", "dev"]
Exactly same problem here 😞 . I'm using Docker Desktop 4.23.0 (120376).
will someone solve the problem?
will someone solve the problem?
You must use a Docker version 4.22 or below to solve the problem.
will someone solve the problem?
You must use a Docker version 4.22 or below to solve the problem.
does this look like a solution?? 😠
will someone solve the problem?
You must use a Docker version 4.22 or below to solve the problem.
does this look like a solution?? 😠
If you think it is or isn't a solution, that's not my problem!!! I used this solution, and it worked for me.
If you are using WSL engine in your docker desktop app, you must run the docker compose command inside it eg /mnt/d/www/your_project
I’ve experienced this issue as well on Windows 11.
Downgrading to Docker 4.22 “solved” it.
I’ve confirmed in line with this Stack Overflow thread that the issue was not due to other programs holding on to the files.
Running commands within WSL did not solve it for me.
This is a major issue; recent versions are entirely unusable because I cannot build images with them.
downgrading is a crutch and not a solution to the problem
I agree with you @DimIsaev. It’s not a real solution. We need a fix.
The purpose of this thread is to provide a solution for docker's users who have the problem mentioned in the issue's title. Whoever wants to fix the bug, He should ask the Docker's team.
I agree with you @ndmekala . We need a fix.
Hello there 👋
Can you test building your failing image with docker build or docker buildx build?
We need to check if the issue is Compose not passing correctly build attributes or if the builder itself is the cause of the issue.
On the original issue Compose try to build app-c and start the FROM composer:latest.
That not Compose pars problem, but the builder.
Just to be sure (cause I have the same problem) I did a 'docker build .' and he fail exactly the same way.
@glorus
It's definitely up to the builder. Another very interesting thing is that if I run the build from the directory where the docker file is located with the command
docker build -f build-vue.Dockerfile .. the image will be built
and with the command
docker build -f build-vue.Dockerfile . will return an error.
And during the image build the context path is the same. I print out the physical path from docker file as variable
For those who are impacted by this issue can you share minimal reproduction steps and a diagnostics id? You can generate one from the terminal. See https://docs.docker.com/desktop/troubleshoot/overview/#diagnose-from-the-terminal
I encountered this error today after upgrading to 4.27.1. I downgraded to 4.22.1 and the issue went away.
Docker Desktop 4.27.2 has been released yesterday can you give it a try and let us know if you still have the issue?
@glours Issue has been resolved for me. Long live Docker team! cheers
I'm experiencing this issue as well. I initially went back to Docker Desktop 4.22, but found that I could upgrade to 4.25.2 as the last working version. Docker Desktop 4.26.0, 4.26.1, 4.27.0, 4.27.1, and 4.27.2 all had the issue. I uninstalled Docker Desktop and did the following, capturing a few diagnostics along the way as requested by @bsousaa
- Installed 4.25.2
- Ran docker build -t falconchristmas/fpp:latest -f Docker/Dockerfile .
- Hit Ctrl^C to stop the build after got past the typical failure point
- Ran & "C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" gather -upload
- Diag ID: 8A97C480-81CE-4F15-B7FD-D5E80EA6F156/20240211200717
- Ran full build (Error expected at Step 9)
- docker build -t falconchristmas/fpp:latest -f Docker/Dockerfile
- Ran & "C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" gather -upload
- Diag ID: 8A97C480-81CE-4F15-B7FD-D5E80EA6F156/20240211201355
- Ran docker system prune -a
- Upgraded to 4.27.2 via Docker Desktop
- Not sure what happened, but upgrade didn't seem to work
- Just installed from 4.27.2 download
- Ran the build with the following results
PS C:\Users\<username>\Documents\GitHub\fpp> docker build -t falconchristmas/fpp:latest -f Docker/Dockerfile .
[+] Building 3.8s (5/16) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.89kB 0.0s
=> [internal] load metadata for docker.io/library/debian:bookworm 1.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> CANCELED [ 1/12] FROM docker.io/library/debian:bookworm@sha256:79becb70a6247d277b59c09ca340bbe0349af6aacb5afa 2.6s
=> => resolve docker.io/library/debian:bookworm@sha256:79becb70a6247d277b59c09ca340bbe0349af6aacb5afa90ec349528b 0.0s
=> => sha256:79becb70a6247d277b59c09ca340bbe0349af6aacb5afa90ec349528b53ce2c9 1.85kB / 1.85kB 0.0s
=> => sha256:f46a268570dff2bdf3b243362802f0e60f511fc396f134952cb1458bd2b2f40c 529B / 529B 0.0s
=> => sha256:e3cbd207d8e55effc51a4738ed80bd81141d0f50c91bd83f9b18d404c129a8a1 1.46kB / 1.46kB 0.0s
=> => sha256:6a299ae9cfd996c1149a699d36cdaa76fa332c8e9d66d6678fa9a231d9ead04c 49.58MB / 49.58MB 1.5s
=> => extracting sha256:6a299ae9cfd996c1149a699d36cdaa76fa332c8e9d66d6678fa9a231d9ead04c 1.1s
=> CANCELED [internal] load build context 2.5s
=> => transferring context: 110.06MB 2.4s
ERROR: failed to solve: Canceled: context canceled
View build details: docker-desktop://dashboard/build/default/default/yj6psscikfyt87cu3tzmqwb07
PS C:\Users\<username>\Documents\GitHub\fpp>
- Ran & "C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" gather -upload
- Diag ID: 8A97C480-81CE-4F15-B7FD-D5E80EA6F156/20240211202220
I'm using this Dockerfile: https://github.com/FalconChristmas/fpp/blob/master/Docker/Dockerfile
Docker Desktop
4.27.2has been released yesterday can you give it a try and let us know if you still have the issue?
Issue still exist for me even after upgrading to 4.27.2.
Docker Desktop
4.27.2has been released yesterday can you give it a try and let us know if you still have the issue?
I also tried updated to 4.27.2 and am still having the same issue.
I get this error, with 4.27.2 I had just upgrading a dockerfile to .net8, I got the above error, I then tried with a old .net7 code branch and it worked.. So I swapped back to .net 8, deleted all bin and obj folders, and still got error. swapped back to .NET 7 branch, and that now also gets the error.
Downgraded to 4.22, and both branches build ok
@ShadowLight8
Sorry for the delay and thanks for the repro.
I'm not able to repro with your Dockerfile in our current 4.28.0 RC with the same version of buildx:
> docker buildx version
github.com/docker/buildx v0.12.1-desktop.4 6996841df2f61988c2794d84d33205368f96c317
> git clone https://github.com/FalconChristmas/fpp
> cd .\fpp
> docker build --progress plain -t falconchristmas/fpp:latest -f Docker/Dockerfile .
...
...
...
#14 66.68
#14 DONE 66.8s
#15 [11/13] RUN rm -rf /tmp/*
#15 DONE 0.5s
#16 [12/13] RUN cp /opt/fpp/etc/asoundrc.plain /root/.asoundrc
#16 DONE 0.5s
#17 [13/13] RUN /opt/fpp/src/fppinit start
#17 0.508 ------------------------------
#17 0.508 Running FPPINIT start
#17 0.508 FPP - Checking for required directories
#17 0.508 Creating directory /home/fpp/media/config
#17 0.508 Creating directory /home/fpp/media/effects
#17 0.508 Creating directory /home/fpp/media/music
#17 0.508 Creating directory /home/fpp/media/playlists
#17 0.508 Creating directory /home/fpp/media/scripts
#17 0.508 Creating directory /home/fpp/media/sequences
#17 0.508 Creating directory /home/fpp/media/upload
#17 0.508 Creating directory /home/fpp/media/videos
#17 0.508 Creating directory /home/fpp/media/plugins
#17 0.508 Creating directory /home/fpp/media/plugindata
#17 0.508 Creating directory /home/fpp/media/exim4
#17 0.508 Creating directory /home/fpp/media/images
#17 0.508 Creating directory /home/fpp/media/cache
#17 0.508 Creating directory /home/fpp/media/backups
#17 0.509 Creating directory /home/fpp/media/tmp
#17 0.509 FPP - Directories created
#17 0.509 Changing hostname from buildkitsandbox to fpp
#17 0.510 hostname: you must be root to change the host name
#17 0.510 ERROR: Unable to open /etc/hosts for writing.
#17 0.511 Creating proxy .htaccess link
#17 0.511 FPP - Checking for Cape/Hat
#17 0.513 System has not been booted with systemd as init system (PID 1). Can't operate.
#17 0.513 Failed to connect to bus: Host is down
#17 15.63 Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
#17 15.63 Did not find eeprom on i2c.
#17 15.63 EEPROM file doesn't exist .
#17 15.63 Could not detect any cape
#17 15.63 Setting file ownership
#17 15.63 ERROR: Unable to open /sys/class/graphics/fbcon/cursor_blink for writing.
#17 DONE 15.7s
#18 exporting to image
#18 exporting layers
#18 exporting layers 3.4s done
#18 writing image sha256:68fb8aebaa96fe23e5db272f3d7e486f98b7984e2ad3b5b694246f8c5e572e53 done
#18 naming to docker.io/falconchristmas/fpp:latest done
#18 DONE 3.4s
View build details: docker-desktop://dashboard/build/default/default/m22lodcftfnt0wozlpxlctlfa
What's the output of docker buildx version on your side?
Same issue on 4.27.2 (137060)
@crazy-max hi there, can you please tell me where can I get 4.28.0 RC Docker Desktop?
docker buildx version github.com/docker/buildx v0.12.1-desktop.4 6996841df2f61988c2794d84d33205368f96c317
Verison WSL: 2.0.14.0 Verison ядра: 5.15.133.1-1 Verison WSLg: 1.0.59 Verison MSRDC: 1.2.4677 Verison Direct3D: 1.611.1-81528511 Verison DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Verison Windows: 10.0.22621.2506
@crazy-max No worries! Here's the output requested for my working install of 4.25.2:
PS C:\Users\<username>\Documents\GitHub\fpp> docker buildx version
github.com/docker/buildx v0.11.2-desktop.5 f20ec1393426619870066baba9618cf999063886
For context, I'm running on Windows 11, WSL2 (Ubuntu 22.04.3), Powershell 7.4.1
Additional info: I upgrade to 4.26.0, confirmed the issue is still present and capture the buildx version:
PS C:\Users\<username>\Documents\GitHub\fpp> .\dockerBuildWin.ps1
[+] Building 5.5s (6/14) docker:default
=> [internal] load build definition from Dockerfile 0.2s
=> => transferring dockerfile: 2.88kB 0.0s
=> [internal] load .dockerignore 0.2s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/debian:bookworm 0.7s
=> [ 1/10] FROM docker.io/library/debian:bookworm@sha256:4482958b4461ff7d9fabc24b3a9ab1e9a2c85ece07b2db1840c7cbc01d053e90 3.3s
=> => resolve docker.io/library/debian:bookworm@sha256:4482958b4461ff7d9fabc24b3a9ab1e9a2c85ece07b2db1840c7cbc01d053e90 0.0s
=> => sha256:4482958b4461ff7d9fabc24b3a9ab1e9a2c85ece07b2db1840c7cbc01d053e90 1.85kB / 1.85kB 0.0s
=> => sha256:fc27237003ad8ffa4608590057eed4e1db8ce6098434b5ecda23f533a5b12e56 529B / 529B 0.0s
=> => sha256:52f537fe03366dda9d36da695b7a02797eeabdb0e0f07cd7d3cb3c878bbf0ada 1.46kB / 1.46kB 0.0s
=> => sha256:7bb465c2914923b08ae03b7fc67b92a1ef9b09c4c1eb9d6711b22ee6bbb46a00 49.55MB / 49.55MB 1.4s
=> => extracting sha256:7bb465c2914923b08ae03b7fc67b92a1ef9b09c4c1eb9d6711b22ee6bbb46a00 1.7s
=> CANCELED [internal] load build context 4.4s
=> => transferring context: 129.59MB 4.3s
=> CANCELED [ 2/10] RUN apt-get update && apt-get -yq upgrade && apt-get install -yq --no-install-recommends --fix-missing -o Acquire::Retries=8 alsa-utils arping avahi-daemon avahi-uti 1.3s
ERROR: failed to solve: Canceled: context canceled
View build details: docker-desktop://dashboard/build/default/default/815nniemrm8vwdvq7tzyt11b1
PS C:\Users\<username>\Documents\GitHub\fpp> docker buildx version
github.com/docker/buildx v0.12.0-desktop.2 c5a13b51c1ae9358eb691e9a21c955590e26d0a0
I had the same problem with Version 4.27.2 and 4.27.1 The error also persists after many downgrades and upgrades. I try to use 4.26 and 4.25. First time 4.26 solves it, second time the error was also in 4.25 after a downgrade (install). My error was only with docker compose build and docker build was working
My solution was to build one time with DOCKER_BUILDKIT=0 and then it seems the knot was torn and now it build again with 4.27.2. Idk why. I hope it helps.
I had the same problem whe trying to run the docker compose up -d --build command from Windows terminal. My solution was to run the same command from the WSL into the /mnt/c/Users/<my_user>/<my_dir_project>.
It seems to me that this is not a problem with Docker itself, but it could be a communication or connection problem between the docker client that windows uses and the docker daemon
Possibly such way can help you to debug issue btw. Open wsl in dir project and run. Docker desktop doesn't show any text error but wsl does
In my case chmod in wsl doesn't help and I've got same issue as before
Always failed on
COPY ../../src/ ./