1
0
Fork 0

Additional arguments for containers

timestamps
dump_stack() 2023-04-06 14:30:42 +00:00
parent 87ef1e42b5
commit 3220b9a5ae
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
1 changed files with 10 additions and 3 deletions

View File

@ -23,6 +23,8 @@ type container struct {
UsrSrc string
Boot string
}
// Additional arguments
Args []string
}
func NewContainer(name string, timeout time.Duration) (c container, err error) {
@ -62,12 +64,17 @@ func (c container) Build(imagePath string) (output string, err error) {
}
func (c container) Run(workdir string, command string) (output string, err error) {
cmd := exec.Command("docker", "run", "--rm",
var args []string
args = append(args, "run", "--rm")
args = append(args, c.Args...)
args = append(args,
"-v", workdir+":/work",
"-v", c.Volumes.LibModules+":/lib/modules",
"-v", c.Volumes.UsrSrc+":/usr/src",
"-v", c.Volumes.Boot+":/boot",
c.name, "bash", "-c", "cd /work && "+command)
"-v", c.Volumes.Boot+":/boot")
args = append(args, c.name, "bash", "-c", "cd /work && "+command)
cmd := exec.Command("docker", args...)
log.Debug().Msgf("%v", cmd)