(*Daemon).fillRootlessVersion: fix nil panic
Fix issue 47085 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
parent
5c4189e6b2
commit
a6d9462cb1
1 changed files with 17 additions and 6 deletions
|
@ -239,16 +239,27 @@ func (daemon *Daemon) fillRootlessVersion(ctx context.Context, v *types.Version)
|
|||
if err != nil {
|
||||
return errors.Wrap(err, "failed to retrieve RootlessKit version")
|
||||
}
|
||||
v.Components = append(v.Components, types.ComponentVersion{
|
||||
rlV := types.ComponentVersion{
|
||||
Name: "rootlesskit",
|
||||
Version: rlInfo.Version,
|
||||
Details: map[string]string{
|
||||
"ApiVersion": rlInfo.APIVersion,
|
||||
"StateDir": rlInfo.StateDir,
|
||||
"NetworkDriver": rlInfo.NetworkDriver.Driver,
|
||||
"PortDriver": rlInfo.PortDriver.Driver,
|
||||
},
|
||||
})
|
||||
}
|
||||
if netDriver := rlInfo.NetworkDriver; netDriver != nil {
|
||||
// netDriver is nil for the "host" network driver
|
||||
// (not used for Rootless Docker)
|
||||
rlV.Details["NetworkDriver"] = netDriver.Driver
|
||||
}
|
||||
if portDriver := rlInfo.PortDriver; portDriver != nil {
|
||||
// portDriver is nil for the "implicit" port driver
|
||||
// (used with "pasta" network driver)
|
||||
//
|
||||
// Because the ports are not managed via RootlessKit API in this case.
|
||||
rlV.Details["PortDriver"] = portDriver.Driver
|
||||
}
|
||||
v.Components = append(v.Components, rlV)
|
||||
|
||||
switch rlInfo.NetworkDriver.Driver {
|
||||
case "slirp4netns":
|
||||
|
|
Loading…
Reference in a new issue