Docker "copy" fails after update – Docker

by
Maya Patel
boot2docker php

Quick Fix: Utilize DOCKER_BUILDKIT=0 before running ‘docker-compose build’ to resolve the issue with Docker ‘copy’ failing after an update, particularly caused by BuildKit.

The Problem:

After updating Docker, attempts to use the copy or add commands during the build process result in errors. The initial error encountered is ‘failed to compute cache key: failed to calculate checksum of ref…:: failed to walk /var/lib/docker/tmp/buildkit-mount2312163789/app/apache: no such file or directory’. Upon moving the file to the same level as the Dockerfile and changing the copy command, a new error is encountered: ‘failed to solve: changes out of order: "app/app.ini" ""’. This issue arose after updating Docker Desktop to version 4.27.0 (Docker version 25.0.1). Determine the cause of these errors and provide a solution to enable successful use of the copy and add commands during the build process.

The Solutions:

Solution 1: Disable BuildKit

The issue arises from BuildKit, a Docker feature aimed at improving performance of building container images. However, it has known issues with certain file copy operations.

To resolve this issue, temporarily disable BuildKit by setting the DOCKER_BUILDKIT environment variable to 0. You can achieve this by using the following command:

DOCKER_BUILDKIT=0 docker-compose build

With BuildKit disabled, your Docker build should proceed without encountering the copy or add errors. Once the build is successful, you can re-enable BuildKit by setting DOCKER_BUILDKIT to 1.

Q&A

Why COPY fails after Docker update?

BuildKit is the cause.

How to fix COPY failure?

Set DOCKER_BUILDKIT=0.

How to fix COPY failure with specific file path?

Move the file app.ini to the same level as the Dockerfile.

Video Explanation:

The following video, titled "Mega Fryday Show: Dead Hook VR | Border Bots | Space Docker ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

15 hours ago ... Mega Fryday Show: Dead Hook VR | Border Bots | Space Docker | Survivorman! | PSVR2 GAMESCAST LIVE. 1.5K views · Streamed 3 hours ago PSVR ...