Skip to content

"podman build" silently adds a variant (to local parent images) #6185

@rb83

Description

@rb83

Issue Description

While building images locally on my M2 (arm64) that are intended to run on linux/amd64 machines, I've encountered a strange phenomenon; in that (locally) built parent images were not found while attempting to build child images that depended on these.

Images were initially duly built by passing --platform=linux/amd64 to podman build. Child images however could only be built by specifying --platform=linux/amd64/v8 (note the nonexisting "v8" variant for amd64).

Interestingly enough, skopeo inspect does not reveal a variant, nor does podman inspect. Hence I assume something is lost (or rather, added) in translation, while podman build looks up the parent image. But I'm not versed enough in the inner workings of podman to interpret this conclusively.

This might be an earlier issue that has reappeared, the limited information and troubleshooting I've found did not really help.

Steps to reproduce the issue

Steps to reproduce the issue

  1. Create two containerfiles:

baseAFile:

FROM busybox
RUN pwd | tee pwd.txt

baseBFile:

FROM myprefix/base-a:latest
RUN echo works
  1. Build the first image: podman build --platform=linux/amd64 -t myprefix/base-a:latest -f baseAFile
STEP 1/2: FROM busybox
STEP 2/2: RUN pwd | tee pwd.txt
/
COMMIT myprefix/base-a:latest
--> 82ea99988343
Successfully tagged localhost/myprefix/base-a:latest
82ea9998834312e87631dbcb9bcc46ad1103656de48738ae5abfddb3a696f38c
  1. Attempt to build the second image: podman build --pull=never --platform=linux/amd64 -t myprefix/base-b:3 -f baseBFile
podman build --pull=never --platform=linux/amd64 -t myprefix/base-b:3 -f baseBFile
STEP 1/2: FROM myprefix/base-a:latest
Error: creating build container: myprefix/base-a:latest: image not known

By manually adjusting the platform the second image can be built:

podman build --pull=never --platform=linux/amd64/v8 -t myprefix/base-b:3 -f baseBFile
STEP 1/2: FROM myprefix/base-a:latest
STEP 2/2: RUN echo works
--> Using cache c5d7958ac4c284becbeae66d549af99643cbae5cbaddc0b054dba3a54cdb1ebb
COMMIT myprefix/base-b:3
--> c5d7958ac4c2
Successfully tagged localhost/myprefix/base-b:3
c5d7958ac4c284becbeae66d549af99643cbae5cbaddc0b054dba3a54cdb1ebb

Describe the results you received

Second image is not built because the first image cannot be found.

Describe the results you expected

Second image is built

podman info output

Client:
  APIVersion: 5.5.0
  BuildOrigin: brew
  Built: 1747162753
  BuiltTime: Tue May 13 20:59:13 2025
  GitCommit: ""
  GoVersion: go1.24.3
  Os: darwin
  OsArch: darwin/arm64
  Version: 5.5.0
host:
  arch: arm64
  buildahVersion: 1.40.0
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.12-3.fc41.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: '
  cpuUtilization:
    idlePercent: 99.07
    systemPercent: 0.37
    userPercent: 0.56
  cpus: 6
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: coreos
    version: "41"
  eventLogger: journald
  freeLocks: 2048
  hostname: localhost.localdomain
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 1000000
    uidmap:
    - container_id: 0
      host_id: 501
      size: 1
    - container_id: 1
      host_id: 100000
      size: 1000000
  kernel: 6.12.13-200.fc41.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 1159102464
  memTotal: 2041810944
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.14.0-1.fc41.aarch64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.14.0
    package: netavark-1.14.0-1.fc41.aarch64
    path: /usr/libexec/podman/netavark
    version: netavark 1.14.0
  ociRuntime:
    name: crun
    package: crun-1.20-2.fc41.aarch64
    path: /usr/bin/crun
    version: |-
      crun version 1.20
      commit: 9c9a76ac11994701dd666c4f0b869ceffb599a66
      rundir: /run/user/501/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^20250121.g4f2c8e7-2.fc41.aarch64
    version: |
      pasta 0^20250121.g4f2c8e7-2.fc41.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: true
    path: unix:///run/user/501/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: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.3.1-1.fc41.aarch64
    version: |-
      slirp4netns version 1.3.1
      commit: e5e368c4f5db6ae75c2fce786e31eef9da6bf236
      libslirp: 4.8.0
      SLIRP_CONFIG_VERSION_MAX: 5
      libseccomp: 2.5.5
  swapFree: 0
  swapTotal: 0
  uptime: 5h 39m 33.00s (Approximately 0.21 days)
  variant: v8
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  docker.io:
    Blocked: false
    Insecure: false
    Location: <internal_redacted>
    MirrorByDigestOnly: false
    Mirrors:
    - Insecure: false
      Location: <internal_redacted>
      PullFromMirror: ""
    Prefix: docker.io
    PullFromMirror: ""
  search:
  - docker.io
  <redacted>:
    Blocked: false
    Insecure: false
    Location: <internal_redacted>
    MirrorByDigestOnly: false
    Mirrors: null
    Prefix: <redacted>
    PullFromMirror: ""
store:
  configFile: /var/home/core/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/home/core/.local/share/containers/storage
  graphRootAllocated: 106415992832
  graphRootUsed: 4560441344
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 27
  runRoot: /run/user/501/containers
  transientStore: false
  volumePath: /var/home/core/.local/share/containers/storage/volumes
version:
  APIVersion: 5.5.0
  BuildOrigin: 'Copr: packit/containers-podman-26126'
  Built: 1747094400
  BuiltTime: Tue May 13 02:00:00 2025
  GitCommit: 0dbcb51477ee7ab8d3b47d30facf71fc38bb0c98
  GoVersion: go1.23.8
  Os: linux
  OsArch: linux/arm64
  Version: 5.5.0

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions