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

Misleading error message when building a nonexistent Containerfile #22940

Closed
jawnsy opened this issue Jun 7, 2024 · 0 comments · Fixed by #22972
Closed

Misleading error message when building a nonexistent Containerfile #22940

jawnsy opened this issue Jun 7, 2024 · 0 comments · Fixed by #22972
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. remote Problem is in podman-remote

Comments

@jawnsy
Copy link

jawnsy commented Jun 7, 2024

Issue Description

When running a build from a context that does not include a Containerfile, users get a friendly error message. However, when attempting to run a nonexistent Containerfile, users get an error message referencing a path in /var/tmp. This may be a quirk of running Podman on MacOS based on underlying volume mount details, since Podman is actually running inside a VM.

Steps to reproduce the issue

I'm running Podman on MacOS, installed via Homebrew.

When attempting to build from a context where there is no Containerfile, users get a nice error message:

$ podman build .
Error: no Containerfile or Dockerfile specified or found in context directory, /Users/jonathan.yu/Projects/foo: no such file or directory

However, when doing the same using a Containerfile specified using -f, we get different output:

$ podman build -f foo
Error: stat /var/tmp/libpod_builder2347678443/build/foo: no such file or directory

To reproduce, simply run this on MacOS: podman build -f foo where the file foo does not exist.

Describe the results you received

The error message references a path that the user knows nothing about:

Error: stat /var/tmp/libpod_builder2347678443/build/foo: no such file or directory

Describe the results you expected

I expected an error message in my home directory, for example:

Error: stat /Users/jonathan.yu/Projects/foo/foo: no such file or directory

Or, perhaps better, a friendly error message modeling the one that appears when running podman build . from a context that does not include a Containerfile:

Error: the specified Contaninerfile or Dockerfile does not exist, /Users/jonathan.yu/Projects/foo/foo: no such file or directory

podman info output

host:
  arch: arm64
  buildahVersion: 1.36.0
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.10-1.fc40.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.10, commit: '
  cpuUtilization:
    idlePercent: 94.05
    systemPercent: 3.3
    userPercent: 2.65
  cpus: 6
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: coreos
    version: "40"
  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: 502
      size: 1
    - container_id: 1
      host_id: 100000
      size: 1000000
  kernel: 6.8.11-300.fc40.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 1510846464
  memTotal: 2044387328
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.11.0-1.20240531102943328308.main.4.g6838c50.fc40.aarch64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.12.0-dev
    package: netavark-1.11.0-1.20240606174759319307.main.8.gfebe31a.fc40.aarch64
    path: /usr/libexec/podman/netavark
    version: netavark 1.12.0-dev
  ociRuntime:
    name: crun
    package: crun-1.15-1.20240607090105650503.main.32.gea54402.fc40.aarch64
    path: /usr/bin/crun
    version: |-
      crun version UNKNOWN
      commit: 7cfd0aeb40e4605b6b0ee0afd9cfca80f9c5f68a
      rundir: /run/user/502/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^20240510.g7288448-1.fc40.aarch64
    version: |
      pasta 0^20240510.g7288448-1.fc40.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/user/502/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.2.2-2.fc40.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 0m 20.00s
  variant: v8
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
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: 106769133568
  graphRootUsed: 4569096192
  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: 0
  runRoot: /run/user/502/containers
  transientStore: false
  volumePath: /var/home/core/.local/share/containers/storage/volumes
version:
  APIVersion: 5.1.1
  Built: 1717459200
  BuiltTime: Mon Jun  3 17:00:00 2024
  GitCommit: ""
  GoVersion: go1.22.3
  Os: linux
  OsArch: linux/arm64
  Version: 5.1.1

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Running on MacOS installed via Homebrew

$ brew info podman
==> podman: stable 5.1.1 (bottled), HEAD
Tool for managing OCI containers and pods
https://podman.io/
Installed
/opt/homebrew/Cellar/podman/5.1.1 (200 files, 74MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-06-07 at 09:20:17
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/p/podman.rb
License: Apache-2.0 and GPL-3.0-or-later
==> Dependencies
Build: go ✘, go-md2man ✘, make ✘
==> Requirements
Required: macOS >= 13 (or Linux) ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
        In order to run containers locally, podman depends on a Linux kernel.
        One can be started manually using `podman machine` from this package.
        To start a podman VM automatically at login, also install the cask
        "podman-desktop".

Bash completion has been installed to:
  /opt/homebrew/etc/bash_completion.d
==> Analytics
install: 19,867 (30 days), 55,200 (90 days), 213,495 (365 days)
install-on-request: 17,139 (30 days), 47,660 (90 days), 185,015 (365 days)

Running the latest podman machine image:

$ podman machine info
host:
    arch: arm64
    currentmachine: podman-machine-default
    defaultmachine: podman-machine-default
    eventsdir: /var/folders/x6/fxyfq2d97nbdvp6vfv7tvzcm0000gp/T/storage-run-502/podman
    machineconfigdir: /Users/jonathan.yu/.config/containers/podman/machine/applehv
    machineimagedir: /Users/jonathan.yu/.local/share/containers/podman/machine/applehv
    machinestate: Running
    numberofmachines: 1
    os: darwin
    vmtype: applehv
version:
    apiversion: 5.1.1
    version: 5.1.1
    goversion: go1.22.3
    gitcommit: bda6eb03dcbcf12a5b7ae004c1240e38dd056d24
    builttime: Tue Jun  4 12:54:07 2024
    built: 1717530847
    osarch: darwin/arm64
    os: darwin

Additional information

I only tested on MacOS and my guess is that this is specific to non-Windows OSes.

@jawnsy jawnsy added the kind/bug Categorizes issue or PR as related to a bug. label Jun 7, 2024
@github-actions github-actions bot added the remote Problem is in podman-remote label Jun 7, 2024
BlackHole1 added a commit to BlackHole1/podman that referenced this issue Jun 27, 2024
When the user specifies a Containerfile or Dockfile with the -f flag in podman build, if the file does not exist, the error should be intuitive to the user.

Fixed: containers#22940

Signed-off-by: Kevin Cui <bh@bugs.cc>
cevich pushed a commit to cevich/podman that referenced this issue Jul 3, 2024
When the user specifies a Containerfile or Dockfile with the -f flag in podman build, if the file does not exist, the error should be intuitive to the user.

Fixed: containers#22940

Signed-off-by: Kevin Cui <bh@bugs.cc>
wLMEB pushed a commit to wLMEB/podman that referenced this issue Jul 4, 2024
When the user specifies a Containerfile or Dockfile with the -f flag in podman build, if the file does not exist, the error should be intuitive to the user.

Fixed: containers#22940

Signed-off-by: Kevin Cui <bh@bugs.cc>
Signed-off-by: Wanqi Li <wanli@umass.edu>
@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Oct 2, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. remote Problem is in podman-remote
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant