buildpacks / pack

CLI for building apps using Cloud Native Buildpacks
https://buildpacks.io
Apache License 2.0
2.53k stars 285 forks source link

pack cli build on podman fails with invalid network name #2242

Closed blatobi closed 3 weeks ago

blatobi commented 1 month ago

Summary

pack build with podman fails with:

ERROR: failed to build: executing lifecycle: failed to create ephemeral bridge network: Error response from daemon: network name pack.local/network/6f676278686d776a6e70 invalid: names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*: invalid argument

Seems to be related to: https://github.com/containers/podman/issues/17746


Reproduction

From docs: https://buildpacks.io/docs/for-app-developers/how-to/special-cases/build-on-podman/ requires podman to be installed

Steps
  1. git clone https://github.com/buildpacks/samples
  2. pack build sample-app -p samples/apps/ruby-bundler/ -B cnbs/sample-builder:jammy
Current behavior
ERROR: failed to build: executing lifecycle: failed to create ephemeral bridge network: Error response from daemon: network name pack.local/network/647a6c6e696166797967 invalid: names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*: invalid argument
Expected behavior

A succesful build


Environment

pack info
╰─ pack report
Pack:
  Version:  0.35.0
  OS/Arch:  linux/amd64

Default Lifecycle Version:  0.19.6

Supported Platform APIs:  0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 0.12, 0.13

Config:
(no config file found at /home/xxxxx/.pack/config.toml)
podman info
host:
  arch: amd64
  buildahVersion: 1.36.0
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: Unknown
    path: /nix/store/mbxcn95wf32cy267jg6f46fpfnxznl49-podman-helper-binary-wrapper/bin/conmon
    version: 'conmon version 2.1.12, commit: '
  cpuUtilization:
    idlePercent: 94.89
    systemPercent: 1.03
    userPercent: 4.09
  cpus: 16
  databaseBackend: sqlite
  distribution:
    codename: vicuna
    distribution: nixos
    version: "24.11"
  eventLogger: journald
  freeLocks: 2014
  hostname: bms-cs21337
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 100
      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.6.43
  linkmode: dynamic
  logDriver: journald
  memFree: 7337373696
  memTotal: 33373638656
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: Unknown
      path: /nix/store/aa9yk6mgigcsl7dxls2fbs135613fa7x-podman-5.1.2/libexec/podman/aardvark-dns
      version: aardvark-dns 1.11.0
    package: Unknown
    path: /nix/store/aa9yk6mgigcsl7dxls2fbs135613fa7x-podman-5.1.2/libexec/podman/netavark
    version: netavark 1.7.0
  ociRuntime:
    name: crun
    package: Unknown
    path: /nix/store/mbxcn95wf32cy267jg6f46fpfnxznl49-podman-helper-binary-wrapper/bin/crun
    version: |-
      crun version 1.15
      commit: 1.15
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  pasta:
    executable: /nix/store/aa9yk6mgigcsl7dxls2fbs135613fa7x-podman-5.1.2/libexec/podman/pasta
    package: Unknown
    version: |
      pasta 2024_06_24.1ee2eca
      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/user/1000/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: ""
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /nix/store/aa9yk6mgigcsl7dxls2fbs135613fa7x-podman-5.1.2/libexec/podman/slirp4netns
    package: Unknown
    version: |-
      slirp4netns version 1.3.1
      commit: e5e368c4f5db6ae75c2fce786e31eef9da6bf236
      libslirp: 4.8.0
      SLIRP_CONFIG_VERSION_MAX: 5
      libseccomp: 2.5.5
  swapFree: 42946953216
  swapTotal: 42949668864
  uptime: 70h 55m 59.00s (Approximately 2.92 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /home/xxxxx/.config/containers/storage.conf
  containerStore:
    number: 5
    paused: 0
    running: 1
    stopped: 4
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/xxxxx/.local/share/containers/storage
  graphRootAllocated: 1023563268096
  graphRootUsed: 191517483008
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /tmp
  imageStore:
    number: 53
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/xxxx/.local/share/containers/storage/volumes
version:
  APIVersion: 5.1.2
  Built: 315532800
  BuiltTime: Tue Jan  1 01:00:00 1980
  GitCommit: ""
  GoVersion: go1.22.5
  Os: linux
  OsArch: linux/amd64
  Version: 5.1.2
blatobi commented 1 month ago

Current workaround:

  1. podman network create pack-local-net
  2. pack build sample-app -p samples/apps/ruby-bundler/ -B cnbs/sample-builder:jammy --network pack-local-net
natalieparellano commented 1 month ago

Should be fixed by https://github.com/buildpacks/pack/pull/2241

Mentioned in https://github.com/buildpacks/pack/issues/2219#issuecomment-2260923340

jjbustamante commented 3 weeks ago

@blatobi

Could you give it a try to release 0.35.1 to confirm this issue is fixed?

blatobi commented 3 weeks ago

I can confirm, the bug is not reproducible in version 0.35.1. A network were created 4d4fe232f4d1 pack.local-network-626a6c696a796e746e73 bridge succesfully.