Additional arguments for containers
This commit is contained in:
parent
87ef1e42b5
commit
3220b9a5ae
13
container.go
13
container.go
@ -23,6 +23,8 @@ type container struct {
|
|||||||
UsrSrc string
|
UsrSrc string
|
||||||
Boot string
|
Boot string
|
||||||
}
|
}
|
||||||
|
// Additional arguments
|
||||||
|
Args []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewContainer(name string, timeout time.Duration) (c container, err error) {
|
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) {
|
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", workdir+":/work",
|
||||||
"-v", c.Volumes.LibModules+":/lib/modules",
|
"-v", c.Volumes.LibModules+":/lib/modules",
|
||||||
"-v", c.Volumes.UsrSrc+":/usr/src",
|
"-v", c.Volumes.UsrSrc+":/usr/src",
|
||||||
"-v", c.Volumes.Boot+":/boot",
|
"-v", c.Volumes.Boot+":/boot")
|
||||||
c.name, "bash", "-c", "cd /work && "+command)
|
args = append(args, c.name, "bash", "-c", "cd /work && "+command)
|
||||||
|
|
||||||
|
cmd := exec.Command("docker", args...)
|
||||||
|
|
||||||
log.Debug().Msgf("%v", cmd)
|
log.Debug().Msgf("%v", cmd)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user