fix: add nil check of DriverConfig (#315)

This commit is contained in:
Shunsuke Suzuki 2021-11-30 23:30:45 +09:00 committed by GitHub
parent 1e55894715
commit 62827ae478
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -269,13 +269,16 @@ func getDockerContainerMounts(container types.ContainerJSON) []map[string]interf
"volume": v,
})
}
m["volume_options"] = []map[string]interface{}{
{
opt := map[string]interface{}{
"no_copy": mount.VolumeOptions.NoCopy,
"labels": labels,
"driver_name": mount.VolumeOptions.DriverConfig.Name,
"driver_options": mount.VolumeOptions.DriverConfig.Options,
},
}
if mount.VolumeOptions.DriverConfig != nil {
opt["driver_name"] = mount.VolumeOptions.DriverConfig.Name
opt["driver_options"] = mount.VolumeOptions.DriverConfig.Options
}
m["volume_options"] = []map[string]interface{}{
opt,
}
}
if mount.TmpfsOptions != nil {