podman installation problem for cni configration

3.8k Views Asked by At

I've just git clone from the repository, and configured all environment, finally after I make install, my podman version prints this:

root@PS-03:/opt/go/src/github.com/containers/libpod# podman version
ERRO[0000] Error loading CNI config file /etc/cni/net.d/99-loopback.conf: error parsing configuration: missing 'type' 
Version:      3.2.0-dev
API Version:  3.2.0-dev
Go Version:   go1.16.3
Git Commit:   d6ec38f2eec6c9ac9e11db5cbf949a357fa13f28
Built:        Sat May  1 16:21:00 2021
OS/Arch:      linux/amd64

And my /etc/cni/net.d/99-loopback.conf content is:

root@PS-03:/opt/go/src/github.com/containers/libpod# more /etc/cni/net.d/99-loopback.conf 
{
  "cniVersion": "0.4.0",
  "name": "podman",
  "plugins": [
    {
      "type": "bridge",
      "bridge": "cni-podman0",
      "isGateway": true,
      "ipMasq": true,
      "hairpinMode": true,
      "ipam": {
        "type": "host-local",
        "routes": [{ "dst": "0.0.0.0/0" }],
        "ranges": [
          [
            {
              "subnet": "10.88.0.0/16",
              "gateway": "10.88.0.1"
            }
          ]
        ]
      }
    },
    {
      "type": "portmap",
      "capabilities": {
        "portMappings": true
      }
    },
    {
      "type": "firewall"
    },
    {
      "type": "tuning"
    }
  ]
}

Can somebody help me with this problem? Thanks.

2

There are 2 best solutions below

0
On

it's so hard guys, I delete the 99-loopback.conf file, and use the default configuration file named "87-podman-bridge.conflist".now, it looks right, hope it can work without issue.

0
On

A bit late here, but the exact answer is that .conf (or .json) is treaten as a single plugin config, whereas .conflist can have multiple config. It's not really clear in any documentation, but it's here:

LoadConfList

func LoadConfList(dir, name string) (*NetworkConfigList, error) {
    files, err := ConfFiles(dir, []string{".conflist"})

versus

LoadConf

func LoadConf(dir, name string) (*NetworkConfig, error) {
    files, err := ConfFiles(dir, []string{".conf", ".json"})