i'm trying to build a simple r-base official docker image but it's giving me a strange "context cancelled" error on windows 10.
i've tried pulling the image (which was successful) and then building it but i'm getting the same error. i've also tried reinstalling docker or building any other image (R or not) from Docker Hub but i'm having no luck with it as well. the strange thing is when i reinstalled docker, it ran the getting-started tutorial on shell without problems.
what may be happening?
here's my dockerfile
FROM r-base:4.0.2
COPY . /usr/local/src/myscripts
WORKDIR /usr/local/src/myscripts
CMD ["Rscript", "main.R"]
and the shell output
C:\Users\jean\path>docker build -t my-image .
[+] Building 1.7s (5/7)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 31B 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/r-base:4.0.2 1.4s
=> CANCELED [internal] load build context 0.1s
=> => transferring context: 7.08kB 0.0s
=> CANCELED [1/3] FROM docker.io/library/r-base:4.0.2@sha256:837898ed6a0dc6f9cb0f3d1fa0e801f01673797cdfd3e21c8cd 0.1s
=> => resolve docker.io/library/r-base:4.0.2@sha256:837898ed6a0dc6f9cb0f3d1fa0e801f01673797cdfd3e21c8cd2ad60f2db 0.0s
=> => sha256:837898ed6a0dc6f9cb0f3d1fa0e801f01673797cdfd3e21c8cd2ad60f2dbe2da 765B / 765B 0.0s
=> => sha256:1c4e181b5dbeef804a4bf1f2c6b888b0d2da333b1a5d99f0e1a3ced46b1cdaef 1.58kB / 1.58kB 0.0s
=> => sha256:673e45d6ffe13b98601b5e19ec2bfbd4ec1b1c135ed9d9e911f6c83c7b9cef1e 5.35kB / 5.35kB 0.0s
error from sender: context canceled
If you want to access the image data directly, it's usually stored in the following locations: Linux: /var/lib/docker/ Windows: C:ProgramDataDockerDesktop. macOS: ~/Library/Containers/com.
The docker build command builds Docker images from a Dockerfile and a “context”. A build's context is the set of files located in the specified PATH or URL . The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to reference a file in the context.
The best way is to put the Dockerfile inside the empty directory and then add only the application and configuration files required for building the docker image. To increase the build's performance, you can exclude files and directories by adding a . dockerignore file to that directory as well.
I ran across the same problem, and discovered the issue was with R/RStudio. I was running the docker build through the terminal pane and it kept giving me the "error from sender: context canceled" comment. I believe that R/RStudio locks up the files it is using, which throws a wrench into the docker machinery when it tries to copy the files. Docker built the image with no problem after I closed RStudio and ran the build through a different terminal.
I had the same problem when I was building the image with DOCKER. The problem is shown in the following image.
After that I closed RStudio, it worked!
I had the same issue when running a Docker build from the RStudio Terminal. For me adding a Windows Firewall rule to allow the app "RStudio Session" fixed it. You can change it by Control Panel
Control Panel\System and Security\Windows Defender Firewall\Allowed apps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With