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"
|
||||
"time"
|
||||
"context"
|
||||
"os"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/go-connections/nat"
|
||||
|
@ -19,6 +20,14 @@ func dockerPullMongo() {
|
|||
ExecSystem("docker pull mongo")
|
||||
}
|
||||
|
||||
func checkDockerExistence() {
|
||||
filePath := "/var/run/docker.sock"
|
||||
|
||||
_, err := os.Stat(filePath)
|
||||
if os.IsNotExist(err) {
|
||||
ExecSystem("dockerd &")
|
||||
}
|
||||
}
|
||||
func dockerRunMongo() {
|
||||
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
|
|
1
main.go
1
main.go
|
@ -87,6 +87,7 @@ func main() {
|
|||
checkSettings()
|
||||
instDeps()
|
||||
genKeys()
|
||||
checkDockerExistence()
|
||||
dockerNetworkCreate()
|
||||
dockerPullMongo()
|
||||
dockerRunMongo()
|
||||
|
|
Loading…
Reference in a new issue