diff --git a/commands/ls.go b/commands/ls.go index a7a5cca924..884515a3c7 100644 --- a/commands/ls.go +++ b/commands/ls.go @@ -91,7 +91,7 @@ func cmdLs(c CommandLine) error { swarmInfo := "" - if item.SwarmOptions.Discovery != "" { + if item.SwarmOptions != nil && item.SwarmOptions.Discovery != "" { swarmInfo = swarmMasters[item.SwarmOptions.Discovery] if item.SwarmOptions.Master { swarmInfo = fmt.Sprintf("%s (master)", swarmInfo)