Handle image pull
This commit is contained in:
parent
1fd0a2d8f3
commit
8259aaa474
2 changed files with 91 additions and 0 deletions
12
jobs.go
12
jobs.go
|
|
@ -30,6 +30,18 @@ func RunJob(jobtype string) (string, error) {
|
|||
mnts = append(mnts, *myVolume)
|
||||
}
|
||||
|
||||
// Check if the image is here
|
||||
hasimg, err := docker.HasImage(jobs[jobtype].Image)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if !hasimg {
|
||||
err = docker.PullImage(jobs[jobtype].Image)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
return docker.Run(
|
||||
jobtype,
|
||||
jobs[jobtype].Image,
|
||||
|
|
|
|||
Reference in a new issue