Docker build error
Description
The Docker build failed with this following error message:
1
2
3
4
=> CANCELED [web internal] load build context 0.1s
=> => transferring context: 362.37kB 0.1s
failed to solve: error from sender: context canceled
This happend to me on my local windows machine. I was trying to build a docker image for my web application.
Problem
There is no apparent reason for the error message. Probably the error is related to some bugs in the docker engine (Windows version).
Suggested solutions: https://stackoverflow.com/questions/77452312/docker-failed-to-solve-canceled-context-canceled-when-loading-build-context
Solutions I Tried
- Adding node modules and other files to the
.dockerignorefile. - Running the docker build command outside WebStorm.
- restarting did not solve the issue
- Running as admin didn’t work
References
https://stackoverflow.com/questions/63330590/error-response-from-daemon-open-pipe-docker-engine-linux-the-system-cannot https://github.com/moby/buildkit/issues/4327
https://forums.docker.com/t/canceled-frontend-internal-load-build-context/138000
Tried to do this
```Use containerd for pulling and storing images Give feedback Use this if you need support for multi-platform images, image lazy-loading, or Wasm. Only images and containers in the active image store are visible. All your other containers and images still exist. To see them again, turn off this feature.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Trying to download previos versions, like this says:
https://github.com/docker/for-win/issues/13812
> You must use a Docker version 4.22 or below to solve the problem.
> Downgrading to Docker 4.22 “solved” it.
https://docs.docker.com/desktop/release-notes/
### Found solution
If your using Windows 11, and using WSL engine in your docker desktop app, Apparently you need to run the docker command from wsl
wsl docker compose up –build ``` It’s not on the docs at lease non that I cloud find.
Found the answer here