mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
refactor: remove all calls to common.NewShellCmdWithArgs
This commit is contained in:
@@ -18,6 +18,19 @@ func ContainerIsRunning(containerID string) bool {
|
||||
return strings.TrimSpace(string(b[:])) == "true"
|
||||
}
|
||||
|
||||
// ContainerStart runs 'docker container start' against an existing container
|
||||
func ContainerStart(containerID string) bool {
|
||||
result, err := CallExecCommand(ExecCommandInput{
|
||||
Command: DockerBin(),
|
||||
Args: []string{"container", "start", containerID},
|
||||
StreamStderr: true,
|
||||
})
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return result.ExitCode == 0
|
||||
}
|
||||
|
||||
// ContainerRemove runs 'docker container remove' against an existing container
|
||||
func ContainerRemove(containerID string) bool {
|
||||
result, err := CallExecCommand(ExecCommandInput{
|
||||
@@ -43,6 +56,19 @@ func ContainerExists(containerID string) bool {
|
||||
return result.ExitCode == 0
|
||||
}
|
||||
|
||||
// ContainerWait runs 'docker container wait' against an existing container
|
||||
func ContainerWait(containerID string) bool {
|
||||
result, err := CallExecCommand(ExecCommandInput{
|
||||
Command: DockerBin(),
|
||||
Args: []string{"container", "wait", containerID},
|
||||
StreamStderr: true,
|
||||
})
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return result.ExitCode == 0
|
||||
}
|
||||
|
||||
// ContainerWaitTilReady will wait timeout seconds and then check if a container is running
|
||||
// returning an error if it is not running at the end of the timeout
|
||||
func ContainerWaitTilReady(containerID string, timeout time.Duration) error {
|
||||
|
||||
Reference in New Issue
Block a user