1
0

Allow to disable container volumes mount

This commit is contained in:
dump_stack() 2023-04-07 17:35:00 +00:00
parent 056e38698e
commit c3cf25e523
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -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...)