Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canceled: context cancelled while "load build context" #13812

Open
ppodgorskicrido opened this issue Nov 28, 2023 · 58 comments
Open

Canceled: context cancelled while "load build context" #13812

ppodgorskicrido opened this issue Nov 28, 2023 · 58 comments

Comments

@ppodgorskicrido
Copy link

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

  1. 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

@randercarlos
Copy link

I figure this problem came in recent versions of docker.

@Henness0666
Copy link

Henness0666 commented Jan 9, 2024

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"]

@jpaddeo
Copy link

jpaddeo commented Jan 18, 2024

Exactly same problem here 😞 . I'm using Docker Desktop 4.23.0 (120376).

image

@DimIsaev
Copy link

will someone solve the problem?

@randercarlos
Copy link

will someone solve the problem?

You must use a Docker version 4.22 or below to solve the problem.

@DimIsaev
Copy link

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?? 😠

@randercarlos
Copy link

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.

@tiaguinhor
Copy link

tiaguinhor commented Jan 22, 2024

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

@ndmekala
Copy link

ndmekala commented Jan 31, 2024

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.

@DimIsaev
Copy link

downgrading is a crutch and not a solution to the problem

@ndmekala
Copy link

I agree with you @DimIsaev. It’s not a real solution. We need a fix.

@randercarlos
Copy link

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.

@nikolaj33
Copy link

I agree with you @ndmekala . We need a fix.

@glours
Copy link

glours commented Feb 7, 2024

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.

@XeuVon
Copy link

XeuVon commented Feb 7, 2024

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.

@nikolaj33
Copy link

@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

@bsousaa
Copy link
Contributor

bsousaa commented Feb 7, 2024

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

@matthewfieger
Copy link

I encountered this error today after upgrading to 4.27.1. I downgraded to 4.22.1 and the issue went away.

@glours
Copy link

glours commented Feb 9, 2024

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?

@nikolaj33
Copy link

@glours
Issue has been resolved for me.
Long live Docker team! cheers

@ShadowLight8
Copy link

ShadowLight8 commented Feb 11, 2024

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

@rmthakur
Copy link

rmthakur commented Feb 12, 2024

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?

Issue still exist for me even after upgrading to 4.27.2.

@ndmekala
Copy link

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?

I also tried updated to 4.27.2 and am still having the same issue.

@Clive321A
Copy link

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
Copy link

ShadowLight8 commented Feb 23, 2024

Good suggestion @ValentinNikolaev! I ended up with an interesting result. I installed Docker Desktop 4.27.2 and tried my build from PowerShell, which failed, then from WSL, which worked fine. Hopefully, this will help debugging while also being a possible workaround.

--- PowerShell ---
PS C:\Users\<username>\Documents\GitHub\fpp> docker build -t falconchristmas/fpp:latest -f Docker/Dockerfile --build-arg FPPBRANCH=$env:FPPBRANCH .
[+] Building 2.5s (5/14)                                                                                                                                                                          docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                        0.0s
 => => transferring dockerfile: 2.88kB                                                                                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/debian:bookworm                                                                                                                                          0.5s
 => [internal] load .dockerignore                                                                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                                                                             0.0s
 => [ 1/10] FROM docker.io/library/debian:bookworm@sha256:4482958b4461ff7d9fabc24b3a9ab1e9a2c85ece07b2db1840c7cbc01d053e90                                                                                  0.0s
 => CANCELED [internal] load build context                                                                                                                                                                  2.0s
 => => transferring context: 118.94MB                                                                                                                                                                       1.9s
ERROR: failed to solve: Canceled: context canceled
--- WSL ---
nick@Trebuchet:/mnt/c/Users/<username>/Documents/GitHub/fpp$ docker build -t falconchristmas/fpp:latest -f Docker/Dockerfile --build-arg FPPBRANCH=$env:FPPBRANCH .
[+] Building 525.6s (15/15) FINISHED                                                                                                                                                              docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                        0.0s
 => => transferring dockerfile: 2.88kB                                                                                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/debian:bookworm                                                                                                                                          0.4s
 => [internal] load .dockerignore                                                                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                                                                             0.0s
 => CACHED [ 1/10] FROM docker.io/library/debian:bookworm@sha256:4482958b4461ff7d9fabc24b3a9ab1e9a2c85ece07b2db1840c7cbc01d053e90                                                                           0.0s
 => [internal] load build context                                                                                                                                                                          10.0s
 => => transferring context: 158.72kB                                                                                                                                                                      10.0s
 => [ 2/10] RUN apt-get update &&     apt-get -yq upgrade && ...
<and so on>

@Enduriel
Copy link

Just ran into this thread, still having this issue with 4.27.2 running from powershell and WSL, exact same behavior as @ValentinNikolaev above in both scenarios for me.

@ShadowLight8
Copy link

ShadowLight8 commented Feb 29, 2024

I've updated to v4.28.0 and am still experiencing the same issue as v4.27.2 when running docker build from PowerShell, but it still works fine from WSL.

PS C:\Users<username>\Documents\GitHub\fpp> docker buildx version
github.com/docker/buildx v0.12.1-desktop.4 6996841df2f61988c2794d84d33205368f96c317

@taco-killchain
Copy link

I had this exact issue using Pycharm. When I docker build using WSL, it failed silently:

=> CANCELED [internal] load build context 0.1s
=> => transferring context: 8.01kB 0.1s
ERROR: failed to solve: error from sender: context canceled

Running it from PowerShell gave a more helpful error:

ERROR: failed to solve: rpc error: code = Unknown desc = read .idea\copilot\chatSessions\xd.lck: The process cannot access the file because another process has locked a portion of the file.

So Github Copilot was causing the problem. I added .idea to .dockerignore (which I should've done anyway, but hey-ho) and it worked fine.

@BernhardK91
Copy link

Wow! Exactly at this moment I am having the same issue, googled and stumbled over the comment that is literally 5 minutes old. Thank you!!

Adding the .idea folder to the .dockerignore solved the issue for me.

@LinusSwahn
Copy link

Adding .idea to the dockerignore solved it. I noticed some new copilot related files in the .idea folder recently and they also interfered with git before jetbrains automatically added them to the gitignore inside the .idea folder.

@YetiCGN
Copy link

YetiCGN commented Mar 11, 2024

Thanks folks! For my TYPO3 project it was a symbolic link in public/typo3conf/ext I had to dockerignore.

@Gavinluo
Copy link

Thanks @taco-killchain , adding .idea to the dockerignore solved it.

@adityaa-codes
Copy link

add the docker volumes to dockerignore solve it for me
PS i have the volumes and my source code in the same folder!

@MLSci
Copy link

MLSci commented Mar 23, 2024

So Dockerfile doesn't overwrite .idea?
Edit: the same error happens to node_modules too.

@ts5h
Copy link

ts5h commented Mar 23, 2024

I've been encountering the same errors and stumped for weeks, but I finally got it to work even with the latest Docker Desktop for Windows (4.28.0) by specifying .idea and node_modules to exclude! Thank you guys so much.

.dockerignore

.idea
node_modules

@Lenstack
Copy link

in my case works when i add **/.idea in .dockerignore

@AlxHer
Copy link

AlxHer commented Mar 25, 2024

Good evening, I have the same problem, I tried to put .idea in dockerignore but nothing changes, I have the problem all the time.

Another solution ?

@ts5h
Copy link

ts5h commented Mar 25, 2024

@AlxHer
As far as I have tried, I had to delete all existing containers, volumes, etc. and start over at first.
(Of course, the cause may be in a different area, so please consider mine is just for reference.)

  1. Make sure .dockerignore is placed in the same directory as the Dockerfile
  2. Delete all existing containers, volumes, etc.
$ docker system prune --volumes
  1. Build the docker container(s) from the beginning like below
$ (Run your necessary commands)
$ docker compose build --no-cache
$ docker compose up -d
$ docker ps

NOTE

  • .dockerignore sample
.idea
node_modules
...

or

**/.idea
**/node_modules
...
  • This solution may not matter much if you are not using JetBrains products.
  • My environment: Windows 11, WSL2 (Ubuntu 22.04.3 LTS), Docker Desktop v4.28.0

@AlxHer
Copy link

AlxHer commented Mar 26, 2024

Sorry @ts5h , I tried everything, it doesn't work.

I am under W11 and V4.28

@adityaa-codes
Copy link

@AlxHer did you try to add volumes created by container to dockerignore?

@AlxHer
Copy link

AlxHer commented Mar 26, 2024

my Dockerfile:

FROM php:8.2-apache

Install system dependencies

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN install-php-extensions mysqli pdo pdo_mysql intl

Set environment variable to allow Composer to run as root

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --disable-tls &&
mv composer.phar /usr/local/bin/composer

RUN apt-get update && apt-get install -yqq nodejs npm

COPY . /var/www/

COPY ./docker/apache.conf /etc/apache2/sites-available/000-default.conf

RUN cd /var/www &&
composer install &&
npm install --force &&
npm run build

WORKDIR /var/www

ENTRYPOINT [ "bash", "./docker/docker.sh" ]

EXPOSE 80

And when I look at the problem it comes from the COPY . /var/www because when I comment this everything works

@adityaa-codes
Copy link

adityaa-codes commented Mar 26, 2024

@AlxHer yeah thats a file permission issue, with .idea / node_modules/ vendor / any docker volumes which is in the same folder as your project files
add them all to dockerignore

@malaterre
Copy link

malaterre commented Mar 27, 2024

Same symptoms here.

> docker build  -f .\ubuntu\22.04\Dockerfile .
[...]
 => [build  1/11] FROM mcr.microsoft.com/dotnet/sdk:7.0-jammy                                                                                                                                               0.0s
 => CANCELED [internal] load build context                                                                                                                                                                  6.2s
 => => transferring context: 112.57MB                                                                                                                                                                       6.2s
 => CACHED [packages 2/4] WORKDIR /packages                                                                                                                                                                 0.0s
ERROR: failed to solve: Canceled: context canceled

However the following does not fail on the same step:

> docker build ubuntu/22.04

So I decided to call docker directly from under WSL (ubuntu 22.04):

> wsl
$ cat /etc/os-release  | grep VER
VERSION_ID="22.04"
[...]
$ docker build --progress=plain -f ubuntu/22.04/Dockerfile .

That solved the symptoms for me...

For reference:

> docker buildx version
github.com/docker/buildx v0.12.1-desktop.4 6996841df2f61988c2794d84d33205368f96c317

Another way to solve the symptoms:

> $Env.DOCKER_BUILDKIT = 0
> docker build  -f .\ubuntu\22.04\Dockerfile .

ref:

@calderonsamuel
Copy link

For Rstudio users, this issue was solved in my project by adding .Rproj.user to the .dockerignore file. It is a hidden directory that Rstudio creates (not sure why) on every project

@Hdurian-CH
Copy link

I've been encountering the same errors and stumped for weeks, but I finally got it to work even with the latest Docker Desktop for Windows (4.28.0) by specifying 我一直遇到同样的错误并困扰了几个星期,但我终于通过指定和排除,即使与最新的 Docker Desktop for Windows (4.28.0) 一起工作 .idea and node_modules to exclude! Thank you guys so much. !非常感谢你们。

我一直遇到同样的错误并困扰了几个星期,但我终于通过指定和排除,即使与最新的 Docker Desktop for Windows (4.28.0) 一起工作 ".idea" "node_modules" !非常感谢你们。

.dockerignore

.idea
node_modules

I solve problem with this

@ko5yak
Copy link

ko5yak commented Apr 6, 2024

I have been following this tutoreal https://youtu.be/0iB5IPoTDts?si=IITBu1CNXT2zwTCP&t=3679 (i included the timestamp)
requirements.txt
Django==5.0.4
django-cors-headers==4.3.1
django-mysql==4.12.0
djangorestframework==3.15.1
mysqlclient==2.2.4
pika==1.3.2

Dockerfile
FROM python:3.10
ENV PYTHONUNBUFFERED 1
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt
COPY . /app

Docker-compose
version: '3.8'
services:
backend:
build:
context: .
dockerfile: Dockerfile
command: 'python manage.py runserver 0.0.0.0:8000'
ports:
- 8000:8000
volumes:
- .:/app
depends_on:
- db
queue:
build:
context: .
dockerfile: Dockerfile
command: 'python consumer.py'
depends_on:
- db
db:
image: mysql:8.3.0
restart: always
environment:
MYSQL_DATABASE: admin
MYSQL_USER: root
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
volumes:
- .dbdata:/var/lib/mysql
ports:
- 33066:3306

returned the following error:
PS \microservices_app\admin> docker-compose up
[+] Building 1.2s (5/9) docker:default
=> [queue internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 198B 0.0s
=> [queue internal] load metadata for docker.io/library/python:3.10 1.1s
=> [queue internal] load .dockerignore 0.0s
=> => transferring context: 98B 0.0s
=> [queue 1/5] FROM docker.io/library/python:3.10@sha256:0be08c1c2c060efbcb8cf14d3d2c3e1e8d3f46ca7cb6937e7565b4658a85b790 0.0s
=> CANCELED [queue internal] load build context 0.0s
=> => transferring context: 102.09kB 0.0s
failed to solve: Canceled: context canceled

i tried adding various suggested .dockerignore files but nothing worked. Has anyone had the same issue and solved it without downgrading docker desktop to 4.22

EDIT: running docker-compose up from WSL clearly identified the cause of the error:
failed to solve: error from sender: open microservices_app/admin/.dbdata/#innodb_redo: permission denied
So the error arises because of the .dbdata folder which has limited permissions, but I feel like exposing the db folder to all users is a security risk. are there anyother solutions?
P.S. Where and when should I use chmod 755?
EDIT №2: I fixed this error by going into WSL and running the docker compose with sudo inside the project directory
sudo docker-compose up

@TrinsyCa
Copy link

will someone solve the problem?

You must use a Docker version 4.22 or below to solve the problem.

How can I downgrade docker version?

@TrinsyCa
Copy link

I encountered this error today after upgrading to 4.27.1. I downgraded to 4.22.1 and the issue went away.

How did you downgraded docker version?

@ShadowLight8
Copy link

How did you downgraded docker version?

While you may have to uninstall your current version, I downloaded older versions from https://docs.docker.com/desktop/release-notes/

@thompson-shaun thompson-shaun self-assigned this Jun 27, 2024
@SAMTEC15
Copy link

I have been having this issue for the past 3days now. I have tried all i could to figure it out but still can't

[+] Building 0.0s (0/0) docker:default
[+] Building 0.5s (9/21) docker:default
=> [auction-svc internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 1.06kB 0.1s
=> [auction-svc internal] load metadata for mcr.microsoft.com/dotnet/aspnet:7.0 0.0s
=> [auction-svc internal] load metadata for mcr.microsoft.com/dotnet/sdk:7.0 0.0s
=> [auction-svc internal] load .dockerignore 0.2s
=> => transferring context: 474B 0.1s
=> [auction-svc build 1/13] FROM mcr.microsoft.com/dotnet/sdk:7.0 0.0s
=> [auction-svc stage-1 1/3] FROM mcr.microsoft.com/dotnet/aspnet:7.0 0.0s
=> CACHED [auction-svc stage-1 2/3] WORKDIR /app 0.0s
=> ERROR [auction-svc internal] load build context 0.2s
=> => transferring context: 68.29kB 0.1s
=> CACHED [auction-svc build 2/13] WORKDIR /app
Screenshot (79)
0.0s

[auction-svc internal] load build context:


failed to solve: changes out of order: "GatewayService/GatewayService.csproj" "Contracts/Contracts.csproj"

@aditya172926
Copy link

I have a volume inside my project root directory. What worked for me in Docker Desktop version 4.27.2 is adding the volume directory to the .dockerignore file.

@SAMTEC15
Copy link

The error changes to this
Screenshot (80)
Screenshot (81)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests