docker / for-mac

Bug reports for Docker Desktop for Mac
https://www.docker.com/products/docker#/mac
2.42k stars 116 forks source link

docker build --no-cache not working on MacOS 12.5 #6944

Open nradosevic opened 11 months ago

nradosevic commented 11 months ago

Description

I'm trying to run docker-compose build of my docker container with --no-cache flag to ignore caches and rebuild everything cause I need to re-run my maven build step.

However, it always use caches no matter what I do.

I tried:

docker system prune -a -f docker builder prune However, it always tries to use caches.

Reproduce

docker system prune -a -f docker builder prune docker build -t --build-arg PLATFORM=linux/amd64 ./ --no-cache

Expected behavior

Caches shouldn't be included, but they are. Even pruning everything doesn't help

docker version

Docker version 23.0.5, build bc4487a

docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.4
    Path:     /Users/nikola/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.17.3
    Path:     /Users/nikola/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/nikola/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.19
    Path:     /Users/nikola/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.4
    Path:     /Users/nikola/.docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/nikola/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/nikola/.docker/cli-plugins/docker-scan
  scout: Command line tool for Docker Scout (Docker Inc.)
    Version:  v0.10.0
    Path:     /Users/nikola/.docker/cli-plugins/docker-scout

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 23.0.5
 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: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version: v1.1.5-0-gf19387a
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.49-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 5
 Total Memory: 7.667GiB
 Name: docker-desktop
 ID: 53c0a79d-1c59-4e28-845d-ca914e8d9d09
 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
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

Diagnostics ID

EDEA4EB9-671E-4711-B6C8-C95EDD776D02/20230815170939

Additional Info

MacOS 12.5

nikola@Nikolas-MacBook-Pro-2 trunk % docker builder prune WARNING! This will remove all dangling build cache. Are you sure you want to continue? [y/N] y ID RECLAIMABLE SIZE LAST ACCESSED m8heul842dm3x8rp8m3tbudhb true 0B 38 seconds ago tf0scd9yisaqp0hz4cr9qfggu true 1.447kB 38 seconds ago q4xjz19cpi6svewufrkyhq2kg true 0B 38 seconds ago s7025dkjknbyfxa22mzzaw632 true 1.855kB 38 seconds ago rdaco35lv54bnt4tpxhyadbvu true 355B 38 seconds ago hteoskb0az82vl4atz2jxc316 true 1.082MB 38 seconds ago dda9gb78osodccckhwy7tc6tb* true 13.93MB 38 seconds ago Total: 15.02MB nikola@Nikolas-MacBook-Pro-2 trunk % docker-compose build news-service --build-arg PLATFORM=linux/amd64 --no-cache [+] Building 2.8s (19/20)
=> [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 1.94kB 0.0s => [internal] load metadata for quay.io/wildfly/wildfly:27.0.1.Final-jdk17 0.9s => https://jdbc.postgresql.org/download/postgresql-42.6.0.jar 1.7s => [internal] load build context 0.1s => => transferring context: 13.96MB 0.1s => CANCELED [ 1/15] FROM quay.io/wildfly/wildfly:27.0.1.Final-jdk17@sha256:8470bc822820e17f7ecb5dc0c02ee9dbe1cdbcc885902253906a682a2d1688de 1.8s => => resolve quay.io/wildfly/wildfly:27.0.1.Final-jdk17@sha256:8470bc822820e17f7ecb5dc0c02ee9dbe1cdbcc885902253906a682a2d1688de 0.0s => => sha256:8470bc822820e17f7ecb5dc0c02ee9dbe1cdbcc885902253906a682a2d1688de 743B / 743B 0.0s => => sha256:a5b4f7f4945b6574db7606dd8175f85a5dd7298b6ffe9cf5c9c19237d76a0efe 1.79kB / 1.79kB 0.0s => => sha256:e8e145a3c6b422ddab5ef5c7a7042c4dec36d5b84c1666cefff20d4d32219347 8.50kB / 8.50kB 0.0s => => sha256:2d473b07cdd5f0912cd6f1a703352c82b512407db6b05b43f2553732b55df3bc 1.05MB / 76.10MB 1.8s => => sha256:50e770a96dde57a5e5a0aa14457724aedca48015617007464fb8d5d08e84cedb 1.05MB / 18.78MB 1.8s => => sha256:c9c96d24fc74f9910704c0fcff09bd6f573c86af6ae88f4e7fdf04efc2e52ffe 5.24MB / 192.44MB 1.8s => CACHED [ 2/15] RUN yum -y install wget 0.0s => CACHED [ 3/15] RUN wget https://downloads.apache.org/maven/maven-3/3.9.3/binaries/apache-maven-3.9.3-bin.tar.gz -P /tmp && tar xf /tmp/apache-maven-3.9.3-bin.tar.gz -C /opt && ln -s /opt/apache-maven-3.9.3 /opt/maven 0.0s => CACHED [ 4/15] ADD https://jdbc.postgresql.org/download/postgresql-42.6.0.jar /tmp/postgresql-42.6.0.jar 0.0s => CACHED [ 5/15] WORKDIR /tmp 0.0s => CACHED [ 6/15] COPY input_files/wildfly-command.sh ./ 0.0s => CACHED [ 7/15] COPY input_files/module-install.cli ./ 0.0s => CACHED [ 8/15] RUN sed -i -e 's/\r$//' ./wildfly-command.sh 0.0s => CACHED [ 9/15] RUN chmod +x ./wildfly-command.sh 0.0s => CACHED [10/15] RUN ./wildfly-command.sh && rm -rf /opt/jboss/wildfly/standalone/configuration/standalone_xml_history/ 0.0s => CACHED [11/15] COPY pom.xml ./ 0.0s => CACHED [12/15] COPY src ./src/ 0.0s => CACHED [13/15] RUN mvn clean package -DskipTests=true -Dmaven.javadoc.skip=true 0.0s => ERROR [14/15] ADD target/cryptonews-2.3.2-debug.war /opt/jboss/wildfly/standalone/deployments/ 0.0s

[14/15] ADD target/cryptonews-2.3.2-debug.war /opt/jboss/wildfly/standalone/deployments/:

failed to solve: failed to compute cache key: failed to calculate checksum of ref moby::joy05flsq4q5cib1n5e0hot1j: "/target/cryptonews-2.3.2-debug.war": not found

JonFranchi commented 7 months ago

Any update on this? This has been reported in other related repos since at least seven months ago.

fisher60 commented 1 month ago

A band-aid fix for this at the moment is to disable docker buildkit via the environment variable DOCKER_BUILDKIT=0. This is not a long-term solution as the legacy builder is deprecated and will eventually be removed, but this works if you need to debug.

i.e DOCKER_BUILDKIT=0 docker build .