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

COPY with wildcard fails when no matching files found #25229

Closed
p5 opened this issue Feb 5, 2025 · 1 comment
Closed

COPY with wildcard fails when no matching files found #25229

p5 opened this issue Feb 5, 2025 · 1 comment
Labels
kind/bug Categorizes issue or PR as related to a bug. remote Problem is in podman-remote

Comments

@p5
Copy link

p5 commented Feb 5, 2025

Issue Description

Not quite sure if this is a bug or a design decision.

If you have a Containerfile which looks like:

FROM scratch
COPY ./hello* /

Produces:

❯ podman build -f Containerfile .
STEP 1/2: FROM scratch
STEP 2/2: COPY ./hello* /
Error: building at STEP "COPY ./hello* /": checking on sources under "/var/tmp/libpod_builder283865622/build": Rel: can't make  relative to /var/tmp/libpod_builder283865622/build; copier: stat: ["/hello*"]: no such file or directory

If you do not have any files present which match that glob pattern, the build fails.
In Docker, if no files match, build still continues and it doesn't copy anything into the image.

Steps to reproduce the issue

See above

Describe the results you received

See above

Describe the results you expected

I would like to have the same behaviour as Docker.
This functionality is useful for when a file may or may not exist, such as the go.sum file. It doesn't exist when you have no external deps, but as soon as you do, you'll want it included in your build.

podman info output

❯ podman info
host:
  arch: amd64
  buildahVersion: 1.38.0-dev
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.12-2.fc40.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: '
  cpuUtilization:
    idlePercent: 98.39
    systemPercent: 1
    userPercent: 0.61
  cpus: 8
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: coreos
    version: "40"
  eventLogger: journald
  freeLocks: 2048
  hostname: localhost.localdomain
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 6.11.3-200.fc40.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 3355230208
  memTotal: 3802005504
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.13.0-1.20241111172239111586.main.21.g63289a6.fc40.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.14.0-dev
    package: netavark-1.13.0-1.20241108145912121588.main.16.g2b0e652.fc40.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.14.0-dev
  ociRuntime:
    name: crun
    package: crun-1.18.1-1.20241031162054462920.main.4.g01830cb.fc40.x86_64
    path: /usr/bin/crun
    version: |-
      crun version UNKNOWN
      commit: 06b0b9e87e71e3dd18a94fcfa2b37fdfcb2d5078
      rundir: /run/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20240906.g6b38f07-1.fc40.x86_64
    version: |
      pasta 0^20240906.g6b38f07-1.fc40.x86_64
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: unix:///run/podman/podman.sock
  rootlessNetworkCmd: pasta
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.2-2.fc40.x86_64
    version: |-
      slirp4netns version 1.2.2
      commit: 0ee2d87523e906518d34a6b423271e4826f71faf
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.5
  swapFree: 0
  swapTotal: 0
  uptime: 0h 2m 11.00s
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /usr/share/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.imagestore: /usr/lib/containers/storage
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 99252940800
  graphRootUsed: 7316963328
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Supports shifting: "true"
    Supports volatile: "true"
    Using metacopy: "true"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 2
  runRoot: /run/containers/storage
  transientStore: false
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 5.3.0-dev-da8995658
  Built: 1731369600
  BuiltTime: Tue Nov 12 00:00:00 2024
  GitCommit: ""
  GoVersion: go1.22.7
  Os: linux
  OsArch: linux/amd64
  Version: 5.3.0-dev-da8995658

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

Yes

Additional environment details

No response

Additional information

Targeting more than one file during the COPY does work, and the build is successful.

# ./world exists
# ./hello* does not exist
FROM scratch
COPY ./world ./hello* /
@p5 p5 added the kind/bug Categorizes issue or PR as related to a bug. label Feb 5, 2025
@github-actions github-actions bot added the remote Problem is in podman-remote label Feb 5, 2025
@Luap99
Copy link
Member

Luap99 commented Feb 5, 2025

Duplicate of containers/buildah#5742

@Luap99 Luap99 marked this as a duplicate of containers/buildah#5742 Feb 5, 2025
@Luap99 Luap99 closed this as completed Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. remote Problem is in podman-remote
Projects
None yet
Development

No branches or pull requests

2 participants