From 908f32ce2dcd185b1d2ad277015ee1dcae091c4b Mon Sep 17 00:00:00 2001 From: cuigh Date: Fri, 1 Mar 2019 16:46:33 +0800 Subject: [PATCH] Fix #23 --- model/docker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/model/docker.go b/model/docker.go index 1cffa56..e8f065a 100644 --- a/model/docker.go +++ b/model/docker.go @@ -275,8 +275,12 @@ func NewServiceInfo(service swarm.Service) *ServiceInfo { if len(spec.TaskTemplate.ContainerSpec.Env) > 0 { si.Environments = Options{} for _, env := range spec.TaskTemplate.ContainerSpec.Env { + var v string pair := strings.SplitN(env, "=", 2) - si.Environments = append(si.Environments, &Option{Name: pair[0], Value: pair[1]}) + if len(pair) == 2 { + v = pair[1] + } + si.Environments = append(si.Environments, &Option{Name: pair[0], Value: v}) } } for _, m := range spec.TaskTemplate.ContainerSpec.Mounts {