Allow to disable container volumes mount
This commit is contained in:
parent
056e38698e
commit
c3cf25e523
17
container.go
17
container.go
@ -188,11 +188,18 @@ func (c container) Run(workdir string, command string) (output string, err error
|
|||||||
var args []string
|
var args []string
|
||||||
args = append(args, "run", "--rm")
|
args = append(args, "run", "--rm")
|
||||||
args = append(args, c.Args...)
|
args = append(args, c.Args...)
|
||||||
args = append(args,
|
if workdir != "" {
|
||||||
"-v", workdir+":/work",
|
args = append(args, "-v", workdir+":/work")
|
||||||
"-v", c.Volumes.LibModules+":/lib/modules",
|
}
|
||||||
"-v", c.Volumes.UsrSrc+":/usr/src",
|
if c.Volumes.LibModules != "" {
|
||||||
"-v", c.Volumes.Boot+":/boot")
|
args = append(args, "-v", c.Volumes.LibModules+":/lib/modules")
|
||||||
|
}
|
||||||
|
if c.Volumes.UsrSrc != "" {
|
||||||
|
args = append(args, "-v", c.Volumes.UsrSrc+":/usr/src")
|
||||||
|
}
|
||||||
|
if c.Volumes.Boot != "" {
|
||||||
|
args = append(args, "-v", c.Volumes.Boot+":/boot")
|
||||||
|
}
|
||||||
args = append(args, c.name, "bash", "-c", "cd /work && "+command)
|
args = append(args, c.name, "bash", "-c", "cd /work && "+command)
|
||||||
|
|
||||||
cmd := exec.Command("docker", args...)
|
cmd := exec.Command("docker", args...)
|
||||||
|
Loading…
Reference in New Issue
Block a user