-
Notifications
You must be signed in to change notification settings - Fork 1
/
funcImagePull.go
58 lines (50 loc) · 1.13 KB
/
funcImagePull.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package iotmakerdockerbuilder
import (
iotmakerdocker "github.com/helmutkemper/iotmaker.docker/v1.0.1"
"github.com/helmutkemper/util"
"log"
"strings"
)
// ImagePull
//
// English:
//
// Downloads the image to be mounted. (equivalent to the docker pull image command)
//
// Output:
// err: standart error object
//
// Português:
//
// Baixa a imagem a ser montada. (equivale ao comando docker pull image)
//
// Saída:
// err: objeto de erro padrão
func (e *ContainerBuilder) ImagePull() (err error) {
if e.printBuildOutput == true {
go func(ch *chan iotmakerdocker.ContainerPullStatusSendToChannel) {
for {
select {
case event := <-*ch:
var stream = event.Stream
stream = strings.ReplaceAll(stream, "\n", "")
stream = strings.ReplaceAll(stream, "\r", "")
stream = strings.Trim(stream, " ")
if stream == "" {
continue
}
log.Printf("%v", stream)
if event.Closed == true {
return
}
}
}
}(&e.changePointer)
}
e.imageID, e.imageName, err = e.dockerSys.ImagePull(e.imageName, &e.changePointer)
if err != nil {
util.TraceToLog()
return
}
return
}