You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to build a podman container, I noticed that a file wasn't being included that I expected to be there. Upon closer investigation, I noticed that a .dockerignore was present in the root directory causing the file not to be copied.
I tried overriding with --ignorefile /dev/null and continued to get the error.
I narrowed it down to what I believe to be the root cause: an empty ignorefile seems to fallback to the default docker ignorefile.
I'd expect if the --ignorefile flag is explicitly set to an empty file, then it should not load the original ignorefile.
Steps to reproduce the issue
abraithwaite at gibson in ~/Projects/github.com/runreveal/example
23:10:39 $ tree -a
.
├── .dockerignore
├── Dockerfile
├── dist
│ ├── altignore.txt
│ ├── asdf1.txt
│ └── asdf2.txt
├── test1.txt
└── test2.txt
2 directories, 6 files
abraithwaite at gibson in ~/Projects/github.com/runreveal/example
23:10:43 $ cat dist/altignore.txt
abraithwaite at gibson in ~/Projects/github.com/runreveal/example
23:14:56 $ cat .dockerignore
test2.txt
**/dist
abraithwaite at gibson in ~/Projects/github.com/runreveal/example
23:10:47 $ cat Dockerfile
FROM alpine:latest
COPY dist/asdf* /tmp/
abraithwaite at gibson in ~/Projects/github.com/runreveal/example
23:11:25 $ podman build --no-cache -t testignore --ignorefile dist/altignore.txt .
STEP 1/2: FROM alpine:latest
STEP 2/2: COPY dist/asdf* /tmp/
Error: building at STEP "COPY dist/asdf* /tmp/": checking on sources under "/var/tmp/libpod_builder1578895609/build": Rel: can't make relative to /var/tmp/libpod_builder1578895609/build; copier: stat: ["/dist/asdf*"]: no such file or directory
Describe the results you received
A somewhat obscure error is thrown and I was left wondering what the heck was happening.
Error: building at STEP "COPY dist/asdf* /tmp/": checking on sources under "/var/tmp/libpod_builder1578895609/build": Rel: can't make relative to /var/tmp/libpod_builder1578895609/build; copier: stat: ["/dist/asdf*"]: no such file or directory
Describe the results you expected
I expect that: when passing in an empty ignore file, the original .dockerignore or .containerignore is overridden and not parsed.
As such, an empty ignore file shouldn't ignore anything.
The use case is that I want to conditionally include files in some builds that are excluded by default for us in the ignorefile.
podman info output
host:
arch: arm64buildahVersion: 1.35.3cgroupControllers:
- cpuset
- cpu
- io
- memory
- pids
- rdma
- misccgroupManager: systemdcgroupVersion: v2conmon:
package: conmon-2.1.10-1.fc39.aarch64path: /usr/bin/conmonversion: 'conmon version 2.1.10, commit: 'cpuUtilization:
idlePercent: 88.47systemPercent: 2.83userPercent: 8.7cpus: 4databaseBackend: sqlitedistribution:
distribution: fedoravariant: coreosversion: "39"eventLogger: journaldfreeLocks: 1597hostname: localhost.localdomainidMappings:
gidmap: nulluidmap: nullkernel: 6.8.4-200.fc39.aarch64linkmode: dynamiclogDriver: journaldmemFree: 2460356608memTotal: 8301178880networkBackend: netavarknetworkBackendInfo:
backend: netavarkdns:
package: aardvark-dns-1.10.0-1.fc39.aarch64path: /usr/libexec/podman/aardvark-dnsversion: aardvark-dns 1.10.0package: netavark-1.10.3-1.fc39.aarch64path: /usr/libexec/podman/netavarkversion: netavark 1.10.3ociRuntime:
name: crunpackage: crun-1.14.4-1.fc39.aarch64path: /usr/bin/crunversion: |- crun version 1.14.4 commit: a220ca661ce078f2c37b38c92e66cf66c012d9c1 rundir: /run/crun spec: 1.0.0 +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJLos: linuxpasta:
executable: /usr/bin/pastapackage: passt-0^20240405.g954589b-1.fc39.aarch64version: | pasta 0^20240405.g954589b-1.fc39.aarch64-pasta 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: truepath: /run/podman/podman.sockrootlessNetworkCmd: ""security:
apparmorEnabled: falsecapabilities: 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_CHROOTrootless: falseseccompEnabled: trueseccompProfilePath: /usr/share/containers/seccomp.jsonselinuxEnabled: trueserviceIsRemote: trueslirp4netns:
executable: /usr/bin/slirp4netnspackage: slirp4netns-1.2.2-1.fc39.aarch64version: |- slirp4netns version 1.2.2 commit: 0ee2d87523e906518d34a6b423271e4826f71faf libslirp: 4.7.0 SLIRP_CONFIG_VERSION_MAX: 4 libseccomp: 2.5.3swapFree: 0swapTotal: 0uptime: 3h 26m 28.00s (Approximately 0.12 days)variant: v8plugins:
authorization: nulllog:
- k8s-file
- none
- passthrough
- journaldnetwork:
- bridge
- macvlan
- ipvlanvolume:
- localregistries:
search:
- docker.iostore:
configFile: /usr/share/containers/storage.confcontainerStore:
number: 17paused: 0running: 5stopped: 12graphDriverName: overlaygraphOptions:
overlay.imagestore: /usr/lib/containers/storageoverlay.mountopt: nodev,metacopy=ongraphRoot: /var/lib/containers/storagegraphRootAllocated: 106769133568graphRootUsed: 60304642048graphStatus:
Backing Filesystem: xfsNative Overlay Diff: "false"Supports d_type: "true"Supports shifting: "true"Supports volatile: "true"Using metacopy: "true"imageCopyTmpDir: /var/tmpimageStore:
number: 199runRoot: /run/containers/storagetransientStore: falsevolumePath: /var/lib/containers/storage/volumesversion:
APIVersion: 5.0.2Built: 1713312000BuiltTime: Tue Apr 16 17:00:00 2024GitCommit: ""GoVersion: go1.21.9Os: linuxOsArch: linux/arm64Version: 5.0.2
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
On macOS, also using podman desktop.
23:13:02 $ podman version
Client: Podman Engine
Version: 5.3.2
API Version: 5.3.2
Go Version: go1.23.5
Git Commit: 85043bb1a3818102194afa82845cb63841067c9c
Built: Tue Jan 21 10:41:34 2025
OS/Arch: darwin/arm64
Server: Podman Engine
Version: 5.0.2
API Version: 5.0.2
Go Version: go1.21.9
Built: Tue Apr 16 17:00:00 2024
OS/Arch: linux/arm64
Additional information
No response
The text was updated successfully, but these errors were encountered:
abraithwaite
changed the title
When --ignorefile is used and it's empty, it causes error with podman build
When --ignorefile is used and it's empty, it causes error with podman build, maybe falls back to default ignorefile.
Jan 29, 2025
I agree that when --ignorefile is present, it should take precedence over any other default fallbacks. There seems to be a bug where we don't pass the ignorefile to buildah during build causing buildah to ignore empty files even though they are specified explicitly.
Issue Description
When trying to build a podman container, I noticed that a file wasn't being included that I expected to be there. Upon closer investigation, I noticed that a .dockerignore was present in the root directory causing the file not to be copied.
I tried overriding with
--ignorefile /dev/null
and continued to get the error.I narrowed it down to what I believe to be the root cause: an empty ignorefile seems to fallback to the default docker ignorefile.
I'd expect if the
--ignorefile
flag is explicitly set to an empty file, then it should not load the original ignorefile.Steps to reproduce the issue
Describe the results you received
A somewhat obscure error is thrown and I was left wondering what the heck was happening.
Describe the results you expected
I expect that: when passing in an empty ignore file, the original
.dockerignore
or.containerignore
is overridden and not parsed.As such, an empty ignore file shouldn't ignore anything.
The use case is that I want to conditionally include files in some builds that are excluded by default for us in the ignorefile.
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
On macOS, also using podman desktop.
Additional information
No response
The text was updated successfully, but these errors were encountered: