Merge pull request #262 from runcom/fix-commands
Read command from ContainerCreateRequest
This commit is contained in:
commit
4cb5af00f6
1 changed files with 13 additions and 3 deletions
|
@ -121,11 +121,21 @@ func (s *Server) createSandboxContainer(containerID string, containerName string
|
||||||
// here set it to be "rootfs".
|
// here set it to be "rootfs".
|
||||||
specgen.SetRootPath("rootfs")
|
specgen.SetRootPath("rootfs")
|
||||||
|
|
||||||
|
processArgs := []string{}
|
||||||
|
commands := containerConfig.GetCommand()
|
||||||
args := containerConfig.GetArgs()
|
args := containerConfig.GetArgs()
|
||||||
if args == nil {
|
if commands == nil && args == nil {
|
||||||
args = []string{"/bin/sh"}
|
// 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()
|
cwd := containerConfig.GetWorkingDir()
|
||||||
if cwd == "" {
|
if cwd == "" {
|
||||||
|
|
Loading…
Reference in a new issue