From f99c0a089ca6f513c8e6738a52677fcaef7838b5 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Mon, 12 Dec 2016 18:56:12 +0100 Subject: [PATCH] Read command from ContainerCreateRequest Signed-off-by: Antonio Murdaca --- server/container_create.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/server/container_create.go b/server/container_create.go index 6c96df93..5fc3d345 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -121,11 +121,21 @@ func (s *Server) createSandboxContainer(containerID string, containerName string // here set it to be "rootfs". specgen.SetRootPath("rootfs") + processArgs := []string{} + commands := containerConfig.GetCommand() args := containerConfig.GetArgs() - if args == nil { - args = []string{"/bin/sh"} + if commands == nil && args == nil { + // TODO: override with image's config in #189 + processArgs = []string{"/bin/sh"} } - specgen.SetProcessArgs(args) + if commands != nil { + processArgs = append(processArgs, commands...) + } + if args != nil { + processArgs = append(processArgs, args...) + } + + specgen.SetProcessArgs(processArgs) cwd := containerConfig.GetWorkingDir() if cwd == "" {