-
Notifications
You must be signed in to change notification settings - Fork 1
/
funcContainerStop.go
57 lines (54 loc) · 1.66 KB
/
funcContainerStop.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
package iotmakerdockerbuilder
import (
"github.com/helmutkemper/util"
)
// ContainerStop
//
// English:
//
// Stop the container
//
// Output:
// err: Default error object.
//
// Note:
//
// * There are two ways to create a container:
// ContainerBuildAndStartFromImage, initializes the oncontainer and initializes the registry to
// the docker network, so that it works correctly.
// ContainerBuildWithoutStartingItFromImage just creates the container, so the first time it runs,
// it must have its network registry initialized, so it can work properly.
// * After initializing the first time, use the functions, ContainerStart, ContainerPause and
// ContainerStop, if you need to control the container.
//
// Português:
//
// Para o container.
//
// Saída:
// err: Objeto de erro padrão.
//
// Nota:
//
// * Ha duas formas de criar um container:
// ContainerBuildAndStartFromImage, inicializa o oncontainer e inicializa o registro aa rede
// docker, para que o mesmo funcione de forma correta.
// ContainerBuildWithoutStartingItFromImage apenas cria o container, por isto, a primeira vez que
// o mesmo roda, ele deve ter o seu registro de rede inicializado para que possa funcionar de
// forma correta.
// * Apos inicializado a primeira vez, use as funções, ContainerStart, ContainerPause e
// ContainerStop, caso necessite controlar o container.
func (e *ContainerBuilder) ContainerStop() (err error) {
if e.containerID == "" {
err = e.getIdByContainerName()
if err != nil {
util.TraceToLog()
return
}
}
err = e.dockerSys.ContainerStop(e.containerID)
if err != nil {
util.TraceToLog()
}
return
}