Nixpkgs: podman doesn't work well

Created on 21 Jul 2019  ยท  12Comments  ยท  Source: NixOS/nixpkgs

Issue description

I'm trying podman, it doesn't work (or i need to configure something and i don't know what / how)

Steps to reproduce

nix-shell --packages podman --command fish
these paths will be fetched (7.33 MiB download, 32.29 MiB unpacked):
  /nix/store/gj6bq2s52l9vgzl0wp0d37jvm2l2zcjg-podman-1.0.0-bin
  /nix/store/rgrwcdir1kbc95rk3igbj5pyk5qm56r9-podman-1.0.0
  /nix/store/zqabb6j60agkcqp5izyqm12gl5k7spcf-bash-interactive-4.4-p23-dev
copying path '/nix/store/zqabb6j60agkcqp5izyqm12gl5k7spcf-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/gj6bq2s52l9vgzl0wp0d37jvm2l2zcjg-podman-1.0.0-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/rgrwcdir1kbc95rk3igbj5pyk5qm56r9-podman-1.0.0' from 'https://cache.nixos.org'...

podman --version
WARN[0000] unable to find /etc/containers/registries.conf. some podman (image shortnames) commands may be limited
podman version 1.0.0

podman info
WARN[0000] unable to find /etc/containers/registries.conf. some podman (image shortnames) commands may be limited
ERRO[0000] No subuid ranges found for user "pinage404" in /etc/subuid

podman run alpine
WARN[0000] unable to find /etc/containers/registries.conf. some podman (image shortnames) commands may be limited
error creating libpod runtime: could not find a working binary (configured options: [/usr/bin/runc /usr/sbin/runc /usr/local/bin/runc /usr/local/sbin/runc /sbin/runc /bin/runc /usr/lib/cri-o-runc/sbin/runc]): invalid argument

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the
results.

  • system: "x86_64-linux"
  • host os: Linux 4.19.58, NixOS, 19.03.173094.5f707e8e06f (Koi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.2.2
  • channels(pinage404): "home-manager-19.03, nixos-19.03.173160.e199c174c69, nixos-unstable-19.09pre185259.362be9608c3"
  • channels(root): "nixos-19.03.173094.5f707e8e06f"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Most helpful comment

I made a shell.nix that's completely self-contained for running podman: https://gist.github.com/adisbladis/187204cb772800489ee3dac4acdd9947.
It also maps the docker command to podman within the shell.

The only thing you have to setup globally is the subuid/subgid ranges for your user.

All 12 comments

You can add the required etc configuration files to your environment:

{ config, pkgs, ... }:
{
  environment = {
    etc."containers/registries.conf".text = import ./etc/containers/registries.nix {};
    etc."containers/policy.json".text     = import ./etc/containers/policy.nix {};
  };
}

I use nix for generating my configuration in /etc, e.g.

{}:''
[registries.search]
registries = ['docker.io', 'quay.io', "gcr.io", "eu.gcr.io"]
''

I added etc."containers/registries.conf" and etc."containers/policy.json"

But i still have the problem

sudo podman info
[sudo] Mot de passe de pinage404 :
could not get runtime: could not find a working binary (configured options: [/usr/bin/runc /usr/sbin/runc /usr/local/bin/runc /usr/local/sbin/runc /sbin/runc /bin/runc /usr/lib/cri-o-runc/sbin/runc]): invalid argument

It seems normal that podman can't find thoses paths under NixOS

But i don't know how you can run it without any other configuration


I found this in man 'libpod.conf'

 runtime_path=""
         Paths to search for a valid OCI runtime binary

But i don't know how to get the nix store path of runc

runc has its own package. You can get the store path to the binary via "${pkgs.runc.bin}/bin/runc".

You can amend your ~/.config/containers/libpod.conf:

conmon_path = ["/run/current-system/sw/bin/conmon", "/usr/libexec/podman/conmon", "/usr/libexec/crio/conmon", "/usr/local/lib/podman/conmon", "/usr/local/libexec/crio/conmon", "/usr/bin/conmon", "/usr/sbin/conmon", "/usr/lib/crio/bin/conmon"]
conmon_env_vars = ["PATH=/run/current-system/sw/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"]

[runtimes]
  runc = ["/run/current-system/sw/bin/runc", "/usr/bin/runc", "/usr/sbin/runc", "/usr/local/bin/runc", "/usr/local/sbin/runc", "/sbin/runc", "/bin/runc", "/usr/lib/cri-o-runc/sbin/runc"]

In addition, you will probably need to install: runc, conmon and slirp4netns.

it seems to not work

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
       โ”‚ File: /home/pinage404/.config/containers/libpod.conf
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   1   โ”‚ conmon_path = ["/run/current-system/sw/bin/conmon", "/usr/libexec/podman/conmon", "/usr/libexec/crio/conmon", "/usr/local/lib/podman/conmon", "/usr/local/libexec/crio/conmon", "/u
       โ”‚ sr/bin/conmon", "/usr/sbin/conmon", "/usr/lib/crio/bin/conmon"]
   2   โ”‚ conmon_env_vars = ["PATH=/run/current-system/sw/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"]
   3   โ”‚
   4   โ”‚ [runtimes]
   5   โ”‚   runc = ["/run/current-system/sw/bin/runc", "/usr/bin/runc", "/usr/sbin/runc", "/usr/local/bin/runc", "/usr/local/sbin/runc", "/sbin/runc", "/bin/runc", "/usr/lib/cri-o-runc/sbin
       โ”‚ /runc"]
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
nix-shell --command "podman info" --packages podman runc conmon slirp4netns
could not get runtime: could not find a working binary (configured options: [/usr/bin/runc /usr/sbin/runc /usr/local/bin/runc /usr/local/sbin/runc /sbin/runc /bin/runc /usr/lib/cri-o-runc/
sbin/runc]): invalid argument

I'm having the same problems with podman. Why doesn't this work out of the box?

We would need a configuration wrapper for podman, which is currently under development in https://github.com/NixOS/nixpkgs/pull/54925

Is it possible to use podman inside a nix-shell, without requiring it to be installed globally?
Together with podman-compose, that would be a awesome and make docker & docker-compose obsolete.

I know most of you (if not all) are referring to NixOS here, but since the package is also available for Linux, I'm wondering if this should also cover running podman correctly as well under that operating system.

I just installed it and I'm getting something similar:

[x80486@uplink ~]$ uname -a
Linux uplink 4.19.73-1-lts #1 SMP Mon Sep 16 17:15:25 CEST 2019 x86_64 GNU/Linux
[x80486@uplink ~]$ podman version
Version:            1.5.1
RemoteAPI Version:  1
Go Version:         go1.12.9
OS/Arch:            linux/amd64
[x80486@uplink ~]$ podman info
Error: could not get runtime: could not find a working conmon binary (configured options: [/usr/libexec/podman/conmon /usr/local/lib/podman/conmon /usr/bin/conmon /usr/sbin/conmon /usr/local/bin/conmon /usr/local/sbin/conmon /run/current-system/sw/bin/conmon]): invalid argument
WARN[0000] unable to find /home/x80486/.config/containers/registries.conf. some podman (image shortnames) commands may be limited
[x80486@uplink ~]$ podman ps -a
Error: could not get runtime: could not find a working conmon binary (configured options: [/usr/libexec/podman/conmon /usr/local/lib/podman/conmon /usr/bin/conmon /usr/sbin/conmon /usr/local/bin/conmon /usr/local/sbin/conmon /run/current-system/sw/bin/conmon]): invalid argument
WARN[0000] unable to find /home/x80486/.config/containers/registries.conf. some podman (image shortnames) commands may be limited 

@VanCoding

Is it possible to use podman inside a nix-shell, without requiring it to be installed globally?

Yes it is, nix-shell -p podman conmon runc slirp4netns. The only global configuration I had to do was set up subuids and subgids for my account.

I made a shell.nix that's completely self-contained for running podman: https://gist.github.com/adisbladis/187204cb772800489ee3dac4acdd9947.
It also maps the docker command to podman within the shell.

The only thing you have to setup globally is the subuid/subgid ranges for your user.

For some reason configuration files in ~/.config often break and podman expects them in /etc/containers. So, I have started running podman in an FHS:

https://github.com/danieldk/nix-home/blob/master/overlays/20-podman.nix

So far, so good...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fdietze picture fdietze  ยท  144Comments

tfc picture tfc  ยท  68Comments

joepie91 picture joepie91  ยท  102Comments

globin picture globin  ยท  65Comments

ttuegel picture ttuegel  ยท  98Comments