podman: Podman build does not keep ENV from Dockerfile on COPY or ADD
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
When using ENV defined vars to select files to ADD or COPY, build fail.
Steps to reproduce the issue:
- Create Dockerfile
FROM scratch
ENV VERSION=0.0.1
COPY file-${VERSION}.txt /
-
Create file
file-0.0.1.txtin same directory -
Use
podman build .to build image on that directory
Describe the results you received:
The build fail with message if file-0.0.1.txt exists:
Error: error dry-running “COPY file-${VERSION}.txt /”: no files found matching “/tmp/podman-test/file-.txt”: no such file or directory
If file-0.0.1.txt does not exists:
Error: error building at STEP “COPY file-${VERSION}.txt /”: no files found matching “/tmp/podman-test/file-0.0.1.txt”: no such file or directory
Describe the results you expected:
Build success with file-0.0.1.txt added to image
Additional information you deem important (e.g. issue happens only occasionally):
I have buildah on my machine and the command buildah bud . works fine. Buildah version is:
Version: 1.10.1
Go Version: go1.10.4
Image Spec: 1.0.1
Runtime Spec: 1.0.1-dev
CNI Spec: 0.4.0
libcni Version:
Git Commit:
Built: Thu Aug 8 17:29:48 2019
OS/Arch: linux/amd64
Output of podman version:
Version: 1.6.2
RemoteAPI Version: 1
Go Version: go1.10.4
OS/Arch: linux/amd64
Output of podman info --debug:
debug:
compiler: gc
git commit: ""
go version: go1.10.4
podman version: 1.6.2
host:
BuildahVersion: 1.11.3
CgroupVersion: v1
Conmon:
package: 'conmon: /usr/bin/conmon'
path: /usr/bin/conmon
version: 'conmon version 2.0.3, commit: unknown'
Distribution:
distribution: neon
version: "18.04"
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
MemFree: 1488613376
MemTotal: 8269008896
OCIRuntime:
name: runc
package: 'containerd.io: /usr/bin/runc'
path: /usr/bin/runc
version: |-
runc version 1.0.0-rc8+dev
commit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
spec: 1.0.1-dev
SwapFree: 2147479552
SwapTotal: 2147479552
arch: amd64
cpus: 8
eventlogger: journald
hostname: s3gui
kernel: 5.0.0-37-generic
os: linux
rootless: true
slirp4netns:
Executable: /usr/bin/slirp4netns
Package: 'slirp4netns: /usr/bin/slirp4netns'
Version: |-
slirp4netns version 0.4.2
commit: unknown
uptime: 39m 49.49s
registries:
blocked: null
insecure: null
search: null
store:
ConfigFile: /home/guilherme/.config/containers/storage.conf
ContainerStore:
number: 1
GraphDriverName: vfs
GraphOptions: {}
GraphRoot: /home/guilherme/.local/share/containers/storage
GraphStatus: {}
ImageStore:
number: 19
RunRoot: /run/user/1000
VolumePath: /home/guilherme/.local/share/containers/storage/volumes
Package info (e.g. output of rpm -q podman or apt list podman):
podman/bionic,now 1.6.2-1~ubuntu18.04~ppa1 amd64 [installed]
Additional environment details (AWS, VirtualBox, physical, etc.):
O.S. on my notebook: KDE Neon based on Ubuntu Bionic
No LSB modules are available.
Distributor ID: neon
Description: KDE neon User Edition 5.17
Release: 18.04
Codename: bionic
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 33 (22 by maintainers)
Commits related to this issue
- Fix COPY in containerfile with envvar If a Containerfile had lines like: ``` FROM alpine ENV VERSION=0.0.1 COPY file-${VERSION}.txt / ``` Buildah would not resolve the VERSION variable in the copy ... — committed to TomSweeneyRedHat/buildah by TomSweeneyRedHat 4 years ago
- Fix COPY in containerfile with envvar If a Containerfile had lines like: ``` FROM alpine ENV VERSION=0.0.1 COPY file-${VERSION}.txt / ``` Buildah would not resolve the VERSION variable in the copy ... — committed to containers/buildah by TomSweeneyRedHat 4 years ago
Thanks @TomSweeneyRedHat ,that did it. Using
$ podman --version podman version 2.1.1which I installed following the development install for CentOS 8 from the linked page.I’m happy to do a release, but won’t get to it until tomorrow (Tues 1/28) if that works.
@giflw Proposed fix at https://github.com/containers/buildah/pull/2095. Once merged we’ll then have to vendor Buildah upstream. Should be in the next release of the Podman (v1.7.1+).
Something’s gone south, it’s not working in Builda upstream, looks like a regression. I’ve been moving to a new PC most of the day today and need to run shortly, will look deeper in the morning.