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

Inconsistent behavior with docker when using COPY and non existing file #5707

Open
netsandbox opened this issue Aug 27, 2024 · 5 comments
Open

Comments

@netsandbox
Copy link

Inconsistent behavior with docker when using COPY and non existing file.

FROM scratch

COPY nonexistingfile.* .

While docker builds the above Containerfile, podman fails with:

STEP 1/2: FROM scratch
STEP 2/2: COPY nonexistingfile.* .
Error: error building at STEP "COPY nonexistingfile.* .": checking on sources under "/home/me/code/podman-copy": Rel: can't make  relative to /home/me/code/podman-copy; copier: stat: ["/nonexistingfile.*"]: no such file or directory

Steps to reproduce the issue:

  1. docker build -t test -f Containerfile . (works)
  2. podman build -t test -f Containerfile . (fails)

Describe the results you received:

Podman fails when using COPY with non existing files.

Describe the results you expected:

Podman should build when using COPY with non existing files, as docker does.

Output of rpm -q buildah or apt list buildah:

buildah/jammy,now 1.23.1+ds1-2 amd64 [installed,automatic]

Output of buildah version:

Version:         1.23.1
Go Version:      go1.17
Image Spec:      1.0.1
Runtime Spec:    1.0.2-dev
CNI Spec:        0.4.0
libcni Version:  
image Version:   5.16.0
Git Commit:      
Built:           Thu Jan  1 01:00:00 1970
OS/Arch:         linux/amd64
BuildPlatform:   linux/amd64

Output of podman version if reporting a podman build issue:

Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.18.1
Built:        Thu Jan  1 01:00:00 1970
OS/Arch:      linux/amd64

Output of docker version:

Client: Docker Engine - Community
 Version:           27.1.2
 API version:       1.46
 Go version:        go1.21.13
 Git commit:        d01f264
 Built:             Mon Aug 12 11:50:12 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          27.1.2
  API version:      1.46 (minimum version 1.24)
  Go version:       go1.21.13
  Git commit:       f9522e5
  Built:            Mon Aug 12 11:50:12 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.20
  GitCommit:        8fc6bcff51318944179630522a095cc9dbf9f353
 runc:
  Version:          1.1.13
  GitCommit:        v1.1.13-0-g58aa920
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of cat /etc/*release:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Output of uname -a:

Linux me 6.8.0-40-generic #40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Output of cat /etc/containers/storage.conf:

cat: /etc/containers/storage.conf: No such file or directory
@nalind
Copy link
Member

nalind commented Aug 28, 2024

It looks like this changed between classic docker build and the newer BuildKit-based docker build, as I get different results by setting DOCKER_BUILDKIT to 0 or 1 in the environment before invoking docker build.

@rhatdan
Copy link
Member

rhatdan commented Aug 29, 2024

We only care about DOCKER_BUILDKIT=1 since we are moving to the new standard.

@netsandbox
Copy link
Author

It didn't work with DOCKER_BUILDKIT=0, but it works with DOCKER_BUILDKIT=1

$ DOCKER_BUILDKIT=0 docker build -f Containerfile .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            BuildKit is currently disabled; enable it by removing the DOCKER_BUILDKIT=0
            environment-variable.

Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM scratch
 ---> 
Step 2/2 : COPY nonexistingfile.* .
COPY failed: no source files were specified
$ DOCKER_BUILDKIT=1 docker build -f Containerfile .
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Containerfile
#1 transferring dockerfile: 79B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.0s

#3 [internal] load build context
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [1/1] COPY nonexistingfile.* .
#4 CACHED

#5 exporting to image
#5 exporting layers done
#5 writing image sha256:810b55b8671ad59944575835a0ddae1ea28ef3c85bed153df3441f7a08e504f7 done
#5 DONE 0.0s

Copy link

A friendly reminder that this issue had no activity for 30 days.

@netsandbox
Copy link
Author

@rhatdan any news regarding this?

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

No branches or pull requests

3 participants