podman
podman copied to clipboard
.containerignore not working
Issue Description
Hello,
I have a project:
. ├── protesta │ ├── back │ │ └── .containerfile │ │ └── app │ └── front │ │ └── .containerfile │ | └── app
I use the following commands to build and run the containers:
Actual_Dir=protesta/{front,back}/
podman build --rm --ignorefile=.containerignore -f containerfile -t pro_back podman run -d --replace -p 8000:8000 --label "io.containers.autoupdate=local" --name pro_back pro_back:latest
podman build --rm --ignorefile=.containerignore -f containerfile -t pro_front podman run -d --replace -p 9010:9010 --label "io.containers.autoupdate=local" --name pro_front pro_front:latest
The problem I'm encountering is that when I build the images, the .containerignore file and the files it should be exclude (e.g., .git*) are still being included in the images.
How can I ensure that the .containerignore file is respected and that the specified files are excluded from the images during the build process?
What did I try?
Move .containerignore to app folder > not work Move .containerignore to root folder (front/back) here is where containerfile is > Not Work Try using --ignorefile > not work.
Steps to reproduce the issue
Steps to reproduce the issue
- Create .containerignore
- build the image using --ignorefile param
- look into build, file include
Describe the results you received
Files that have to be ignore in the .containerignore list, is not ignored
Describe the results you expected
Container without files from .containerignore
podman info output
host:
arch: amd64
buildahVersion: 1.33.8
cgroupControllers:
- pids
cgroupManager: systemd
cgroupVersion: v2
conmon:
package: conmon-2.1.10-150500.9.9.1.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.1.10, commit: unknown'
cpuUtilization:
idlePercent: 99.48
systemPercent: 0.07
userPercent: 0.44
cpus: 12
databaseBackend: sqlite
distribution:
distribution: opensuse-leap
version: "15.6"
eventLogger: file
freeLocks: 2046
hostname: OSAD
idMappings:
gidmap:
- container_id: 0
host_id: 1000
size: 1
- container_id: 1
host_id: 100000
size: 65536
uidmap:
- container_id: 0
host_id: 1000
size: 1
- container_id: 1
host_id: 100000
size: 65536
kernel: 6.4.0-150600.23.17-default
linkmode: dynamic
logDriver: k8s-file
memFree: 4352016384
memTotal: 16793542656
networkBackend: cni
networkBackendInfo:
backend: cni
dns: {}
package: |-
cni-1.1.2-150500.3.2.1.x86_64
cni-plugins-1.1.1-150500.3.2.1.x86_64
path: /usr/lib/cni
ociRuntime:
name: runc
package: runc-1.1.13-150000.67.1.x86_64
path: /usr/bin/runc
version: |-
runc version 1.1.13
commit: v1.1.13-0-g51d5e94601ce
spec: 1.0.2-dev
go: go1.21.12
libseccomp: 2.5.3
os: linux
pasta:
executable: ""
package: ""
version: ""
remoteSocket:
exists: true
path: /run/user/1000/podman/podman.sock
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: true
seccompEnabled: true
seccompProfilePath: /etc/containers/seccomp.json
selinuxEnabled: false
serviceIsRemote: false
slirp4netns:
executable: /usr/bin/slirp4netns
package: slirp4netns-1.2.2-150600.1.5.x86_64
version: |-
slirp4netns version 1.2.2
commit: 0ee2d87523e906518d34a6b423271e4826f71faf
libslirp: 4.7.0
SLIRP_CONFIG_VERSION_MAX: 5
libseccomp: 2.5.3
swapFree: 0
swapTotal: 0
uptime: 68h 40m 14.00s (Approximately 2.83 days)
variant: ""
plugins:
authorization: null
log:
- k8s-file
- none
- passthrough
- journald
network:
- bridge
- macvlan
- ipvlan
volume:
- local
registries:
search:
- registry.opensuse.org
- registry.suse.com
- docker.io
store:
configFile: /opt/protesta/.config/containers/storage.conf
containerStore:
number: 2
paused: 0
running: 2
stopped: 0
graphDriverName: btrfs
graphOptions: {}
graphRoot: /opt/protesta/.local/share/containers/storage
graphRootAllocated: 536858329088
graphRootUsed: 40698335232
graphStatus:
Build Version: 'Btrfs v5.14 '
Library Version: "102"
imageCopyTmpDir: /var/tmp
imageStore:
number: 107
runRoot: /run/user/1000/containers
transientStore: false
volumePath: /opt/protesta/.local/share/containers/storage/volumes
version:
APIVersion: 4.9.5
Built: 1719835200
BuiltTime: Mon Jul 1 08:00:00 2024
GitCommit: ""
GoVersion: go1.21.11
Os: linux
OsArch: linux/amd64
Version: 4.9.5
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
No
Additional environment details
openSUSE Leap 15.6
Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting
@DevDorrejo Would you be able to try this on podman v5.2.2 ?
Using **/.git apply the change.
Being a little more explicit in the documentation will be useful, for example my case.
Interested in opening a PR to improve the documentation?
Interested in opening a PR to improve the documentation?
will do, need to learn a little more, new in this
Interested in opening a PR to improve the documentation?
will do, need to learn a little more, new in this