run docker daemon manually in CI environment
This commit is contained in:
parent
640ae4392d
commit
c9acf34a5b
2 changed files with 10 additions and 0 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
"context"
|
"context"
|
||||||
|
"os"
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
|
@ -19,6 +20,14 @@ func dockerPullMongo() {
|
||||||
ExecSystem("docker pull mongo")
|
ExecSystem("docker pull mongo")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkDockerExistence() {
|
||||||
|
filePath := "/var/run/docker.sock"
|
||||||
|
|
||||||
|
_, err := os.Stat(filePath)
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
ExecSystem("dockerd &")
|
||||||
|
}
|
||||||
|
}
|
||||||
func dockerRunMongo() {
|
func dockerRunMongo() {
|
||||||
|
|
||||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||||
|
|
1
main.go
1
main.go
|
@ -87,6 +87,7 @@ func main() {
|
||||||
checkSettings()
|
checkSettings()
|
||||||
instDeps()
|
instDeps()
|
||||||
genKeys()
|
genKeys()
|
||||||
|
checkDockerExistence()
|
||||||
dockerNetworkCreate()
|
dockerNetworkCreate()
|
||||||
dockerPullMongo()
|
dockerPullMongo()
|
||||||
dockerRunMongo()
|
dockerRunMongo()
|
||||||
|
|
Loading…
Reference in a new issue