podman icon indicating copy to clipboard operation
podman copied to clipboard

Unable to build multi-arch via Podman CURL / API.

Open cdrage opened this issue 1 year ago • 5 comments

Issue Description

When trying to pass in --platform equivalent within the API, I am getting this parsing error:

{"cause":"invalid argument","message":"failed to parse query parameter 'platform': \"linux/arm64,linux/amd64\": invalid platform syntax for --platform=\"linux/arm64,linux/amd64\": \"arm64,linux\" is an invalid component of \"linux/arm64,linux/amd64\": platform specifier component must match \"^[A-Za-z0-9_-]+$\": invalid argument","response":400}

Steps to reproduce the issue

Steps to reproduce the issue

  1. Package any Containerfile (tar -czf context.tar.gz -C dir .)
  2. Use the below CURL command:
curl --unix-socket ~/.local/share/containers/podman/machine/applehv/podman.sock -X POST \
     -H "Content-Type: application/tar" \
     -H "Content-Encoding: gzip" \
     --data-binary "@context.tar.gz" \
     "http://d/v4.0.0/libpod/build?platform=linux/arm64,linux/amd64&t=quay.io/mytestcontainer"

{"cause":"invalid argument","message":"failed to parse query parameter 'platform': \"linux/arm64,linux/amd64\": invalid platform syntax for --platform=\"linux/arm64,linux/amd64\": \"arm64,linux\" is an invalid component of \"linux/arm64,linux/amd64\": platform specifier component must match \"^[A-Za-z0-9_-]+$\": invalid argument","response":400}

Describe the results you received

Getting a platform error (see above).

Describe the results you expected

Passing, similar to:

podman build --platform="linux/arm64,linux/amd64" -t mytestcontainer .

podman info output

▶ podman info
host:
  arch: arm64
  buildahVersion: 1.34.1-dev
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.10-1.fc39.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.10, commit: '
  cpuUtilization:
    idlePercent: 98.84
    systemPercent: 0.65
    userPercent: 0.51
  cpus: 5
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: coreos
    version: "39"
  eventLogger: journald
  freeLocks: 2020
  hostname: localhost.localdomain
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 6.7.5-200.fc39.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 510242816
  memTotal: 2047860736
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.10.0-1.20240229100444279141.main.16.g03ce519.fc39.aarch64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.11.0-dev
    package: netavark-1.10.1-1.20240229113356745230.main.40.g773fd54.fc39.aarch64
    path: /usr/libexec/podman/netavark
    version: netavark 1.11.0-dev
  ociRuntime:
    name: crun
    package: crun-1.14.3-1.20240229113428746398.main.10.g31aab34.fc39.aarch64
    path: /usr/bin/crun
    version: |-
      crun version UNKNOWN
      commit: aea8fc0fc7d0aabdbcfd1462d7bf6ea0d1e5215b
      rundir: /run/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^20240220.g1e6f92b-1.fc39.aarch64
    version: |
      pasta 0^20240220.g1e6f92b-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: true
    path: /run/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: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.2-1.fc39.aarch64
    version: |-
      slirp4netns version 1.2.2
      commit: 0ee2d87523e906518d34a6b423271e4826f71faf
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 0h 32m 30.00s
  variant: v8
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /usr/share/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 0
    stopped: 2
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 106769133568
  graphRootUsed: 21349634048
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Supports shifting: "true"
    Supports volatile: "true"
    Using metacopy: "true"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 10
  runRoot: /run/containers/storage
  transientStore: false
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 5.0.0-dev-96f9d0867
  Built: 1709164800
  BuiltTime: Wed Feb 28 19:00:00 2024
  GitCommit: ""
  GoVersion: go1.21.7
  Os: linux
  OsArch: linux/arm64
  Version: 5.0.0-dev-96f9d0867


### Podman in a container

No

### Privileged Or Rootless

None

### Upstream Latest Release

Yes

### Additional environment details

Additional environment details

### Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

cdrage avatar Mar 18 '24 13:03 cdrage

Closing this as this is intentional in the API and not a bug.

To create multi-platform / multi-arch, it's creating a manifest, then building, then adding it to manifest.

cdrage avatar Mar 22 '24 14:03 cdrage

It should work, by setting a "manifest" parameter and passing two "platform" parameters.

nalind avatar Mar 27 '24 17:03 nalind

(Whether needing to set "manifest" rather than "t" and needing to supply elements of the platforms list in separate "platform" arguments is a bug is not something I'm enough of an expert to weigh in on.)

nalind avatar Mar 27 '24 17:03 nalind

I'll reopen given Nalin's comments

mheon avatar Mar 27 '24 18:03 mheon

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Apr 27 '24 00:04 github-actions[bot]

The docker API seems to accept comma separated values so we must match this in the API.

Luap99 avatar Jun 25 '24 16:06 Luap99