diff --git a/runtime/container.go b/runtime/container.go index 6918f1c18..ac2280080 100644 --- a/runtime/container.go +++ b/runtime/container.go @@ -365,18 +365,6 @@ func populateCommand(c *Container, env []string) { c.command.Env = env } -func (container *Container) ArgsAsString() string { - var args []string - for _, arg := range container.Args { - if strings.Contains(arg, " ") { - args = append(args, fmt.Sprintf("'%s'", arg)) - } else { - args = append(args, arg) - } - } - return strings.Join(args, " ") -} - func (container *Container) Start() (err error) { container.Lock() defer container.Unlock() diff --git a/server/server.go b/server/server.go index 2de7dbc87..613df9a32 100644 --- a/server/server.go +++ b/server/server.go @@ -1063,7 +1063,17 @@ func (srv *Server) Containers(job *engine.Job) engine.Status { out.SetList("Names", names[container.ID]) out.Set("Image", srv.runtime.Repositories().ImageName(container.Image)) if len(container.Args) > 0 { - out.Set("Command", fmt.Sprintf("\"%s %s\"", container.Path, container.ArgsAsString())) + args := []string{} + for _, arg := range container.Args { + if strings.Contains(arg, " ") { + args = append(args, fmt.Sprintf("'%s'", arg)) + } else { + args = append(args, arg) + } + } + argsAsString := strings.Join(args, " ") + + out.Set("Command", fmt.Sprintf("\"%s %s\"", container.Path, argsAsString)) } else { out.Set("Command", fmt.Sprintf("\"%s\"", container.Path)) }