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

podman: fails to substitute ARG in Dockerfile #4393

Closed
XVilka opened this issue Oct 31, 2019 · 1 comment
Closed

podman: fails to substitute ARG in Dockerfile #4393

XVilka opened this issue Oct 31, 2019 · 1 comment
Labels

Comments

@XVilka
Copy link

@XVilka XVilka commented Oct 31, 2019

/kind bug

Description

Buildah fails to substitute variables in some cases

Steps to reproduce the issue:

  1. git clone https://github.com/XVilka/alpine-dev-env

  2. ./build

  3. ./run

  4. cat /etc/pkg/repositories

Describe the results you received:

The last cat commands shows this content:

/home/${username}/packages/main
...

Which means clearly it didn't subsittute argument in this sed invocation:

ARG username=akochkov

RUN sed -i.bkp -e \
	'1s;^;/home/${username}/packages/testing\n;' \
	/etc/apk/repositories && \
	sed -i.bkp -e \
	'1s;^;/home/${username}/packages/community\n;' \
	/etc/apk/repositories && \
	sed -i.bkp -e \
	'1s;^;/home/${username}/packages/main\n;' \
	/etc/apk/repositories

This sed invocation didn't substitute the variables either:

RUN sed -i.bkp -e \
	's/#PACKAGER="Your Name <your@email.address>"/PACKAGER="${realname} <${email}>"/g' \
	/etc/abuild.conf
RUN sed -i.bkp -e \
	's/#MAINTAINER="$PACKAGER"/MAINTAINER="$PACKAGER"/g' \
	/etc/abuild.conf

Note, if I change the sed commands to use double quote, it works fine, e.g.:

ARG username=akochkov

RUN sed -i.bkp -e \
	"1s;^;/home/${username}/packages/testing\n;" \
	/etc/apk/repositories && \
	sed -i.bkp -e \
	"1s;^;/home/${username}/packages/community\n;" \
	/etc/apk/repositories && \
	sed -i.bkp -e \
	"1s;^;/home/${username}/packages/main\n;" \
	/etc/apk/repositories

Describe the results you expected:

/home/akochkov/packages/main
...

Output of podman version:

Version: 1.6.2
RemoteAPI Version: 1
Go Version: go1.13.1
OS/Arch: linux/amd64

Output of podman info --debug:

debug:
  compiler: gc
  git commit: ""
  go version: go1.13.1
  podman version: 1.6.2
host:
  BuildahVersion: 1.11.3
  CgroupVersion: v2
  Conmon:
    package: conmon-2.0.2-1.fc31.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.2, commit: 186a550ba0866ce799d74006dab97969a2107979'
  Distribution:
    distribution: fedora
    version: "31"
  IDMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 2000544
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 2000544
      size: 65536
  MemFree: 1802358784
  MemTotal: 16675573760
  OCIRuntime:
    name: crun
    package: crun-0.10.2-1.fc31.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.10.2
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  SwapFree: 8370253824
  SwapTotal: 8426352640
  arch: amd64
  cpus: 8
  eventlogger: journald
  hostname: localhost.localdomain
  kernel: 5.3.7-301.fc31.x86_64
  os: linux
  rootless: true
  slirp4netns:
    Executable: /usr/bin/slirp4netns
    Package: slirp4netns-0.4.0-20.1.dev.gitbbd6f25.fc31.x86_64
    Version: |-
      slirp4netns version 0.4.0-beta.3+dev
      commit: bbd6f25c70d5db2a1cd3bfb0416a8db99a75ed7e
  uptime: 25h 7m 34.1s (Approximately 1.04 days)
registries:
  blocked: null
  insecure: null
  search:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ConfigFile: /home/akochkov/.config/containers/storage.conf
  ContainerStore:
    number: 33
  GraphDriverName: overlay
  GraphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: fuse-overlayfs-0.6.5-2.fc31.x86_64
      Version: |-
        fusermount3 version: 3.6.2
        fuse-overlayfs: version 0.6.5
        FUSE library version 3.6.2
        using FUSE kernel interface version 7.29
  GraphRoot: /home/akochkov/.local/share/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 82
  RunRoot: /run/user/1000
  VolumePath: /home/akochkov/.local/share/containers/storage/volumes

Package info (e.g. output of rpm -q podman or apt list podman):

podman-1.6.2-2.fc31.x86_64
@TomSweeneyRedHat

This comment has been minimized.

Copy link
Collaborator

@TomSweeneyRedHat TomSweeneyRedHat commented Oct 31, 2019

Duplicate of containers/buildah#1957, closing here, discussions/updates to continue on the Buildah issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.