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 compose does not find compose providers not in PATH #20502

Closed
xduugu opened this issue Oct 26, 2023 · 5 comments · Fixed by #20508
Closed

podman compose does not find compose providers not in PATH #20502

xduugu opened this issue Oct 26, 2023 · 5 comments · Fixed by #20508
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.

Comments

@xduugu
Copy link
Contributor

xduugu commented Oct 26, 2023

Issue Description

If you place the docker-compose binary into a directory that is not in your PATH, e.g. $HOME/.docker/cli-plugins/, which is, according to the default configuration, a supported location, podman compose only returns the error

Error: exec: "docker-compose": executable file not found in $PATH

Steps to reproduce the issue

Steps to reproduce the issue

  1. place the docker-compose binary into one of the supported docker cli-plugins directories
  2. run podman compose

Describe the results you received

podman prints the error message:

Error: exec: "docker-compose": executable file not found in $PATH

Describe the results you expected

podman compose should find docker-compose as compose provider and run it.

podman info output

host:
  arch: amd64
  buildahVersion: 1.33.0-dev
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.7-3.fc39.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.7, commit: '
  cpuUtilization:
    idlePercent: 97.66
    systemPercent: 0.83
    userPercent: 1.5
  cpus: 16
  databaseBackend: boltdb
  distribution:
    distribution: fedora
    variant: workstation
    version: "39"
  eventLogger: journald
  freeLocks: 2048
  hostname: fedora
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      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.5.6-300.fc39.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 17862057984
  memTotal: 32817713152
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.7.0-2.fc39.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.7.0
    package: netavark-1.7.0-2.fc39.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.7.0
  ociRuntime:
    name: crun
    package: crun-1.9-1.fc39.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.9
      commit: a538ac4ea1ff319bcfe2bf81cb5c6f687e2dc9d3
      rundir: /run/user/1000/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^20230908.g05627dc-1.fc39.x86_64
    version: |
      pasta 0^20230908.g05627dc-1.fc39.x86_64
      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: false
    path: /run/user/1000/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: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.1-1.fc39.x86_64
    version: |-
      slirp4netns version 1.2.1
      commit: 09e31e92fa3d2a1d3ca261adaeb012c8d75a8194
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 8589930496
  swapTotal: 8589930496
  uptime: 1h 13m 17.00s (Approximately 0.04 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /home/xduugu/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/xduugu/.local/share/containers/storage
  graphRootAllocated: 998380109824
  graphRootUsed: 335406395392
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 4
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/xduugu/.local/share/containers/storage/volumes
version:
  APIVersion: 4.8.0-dev
  Built: 1698350044
  BuiltTime: Thu Oct 26 21:54:04 2023
  GitCommit: e5101b28deff158feb8cd69a25c082a441c07c9a
  GoVersion: go1.21.3
  Os: linux
  OsArch: linux/amd64
  Version: 4.8.0-dev

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

The error returned by

path, err := exec.LookPath(os.ExpandEnv(candidate))

Error: exec: "docker-compose": executable file not found in $PATH

Is apparently not an os.ErrNotExist error, so that all the other candidates are not even tried.

if errors.Is(err, os.ErrNotExist) {
continue
}

It is probably sufficient to remove this check and simply always continue in case of an error.

@xduugu xduugu added the kind/bug Categorizes issue or PR as related to a bug. label Oct 26, 2023
@vrothberg
Copy link
Member

Thanks for reaching out, @xduugu!
I'll spin up a PR 👍

@vrothberg
Copy link
Member

@xduugu feel free to try out the fix in #20508

vrothberg added a commit to vrothberg/libpod that referenced this issue Oct 27, 2023
Do not error out immediately but collect all errors and report them if
no candidate succeeded.  That'll fix containers#20502 and improve the quality of
reported errors.

[NO NEW TESTS NEEDED]

Fixes: containers#20502
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/podman that referenced this issue Oct 27, 2023
Do not error out immediately but collect all errors and report them if
no candidate succeeded.  That'll fix containers#20502 and improve the quality of
reported errors.

[NO NEW TESTS NEEDED]

Fixes: containers#20502
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
@xduugu
Copy link
Contributor Author

xduugu commented Oct 30, 2023

@vrothberg Thanks for the quick fix!

Only the debug message could be improved:

Error looking up compose provider "": exec: "docker-compose": executable file not found in $PATH

path probably should have been candidate here:

logrus.Debugf("Error looking up compose provider %q: %v", path, err)

@vrothberg
Copy link
Member

Nice catch, @xduugu. Are you interested in opening a Pull Request?

@xduugu
Copy link
Contributor Author

xduugu commented Nov 1, 2023

@vrothberg I've opened a pull request #20565

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Jan 31, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants