mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-07-14 10:17:26 +08:00
Provide DIND override through DIND_IMAGE env variable. Use pinned version of DIND by default instead of latest to prevent surprises.
This commit is contained in:
parent
f91af56a09
commit
11749c4902
@ -2,6 +2,7 @@ package services
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
ptypes "github.com/franela/play-with-docker/types"
|
ptypes "github.com/franela/play-with-docker/types"
|
||||||
@ -81,7 +82,12 @@ func CreateInstance(net string) (*ptypes.Instance, error) {
|
|||||||
h := &container.HostConfig{NetworkMode: container.NetworkMode(net), Privileged: true}
|
h := &container.HostConfig{NetworkMode: container.NetworkMode(net), Privileged: true}
|
||||||
h.Resources.PidsLimit = maximumPidLimit
|
h.Resources.PidsLimit = maximumPidLimit
|
||||||
|
|
||||||
conf := &container.Config{Image: "docker:dind"}
|
dindImage := os.Getenv("DIND_IMAGE")
|
||||||
|
if len(dindImage) == 0 {
|
||||||
|
dindImage = "docker:1.12.2-rc2-dind"
|
||||||
|
}
|
||||||
|
|
||||||
|
conf := &container.Config{Image: dindImage}
|
||||||
container, err := c.ContainerCreate(context.Background(), conf, h, nil, "")
|
container, err := c.ContainerCreate(context.Background(), conf, h, nil, "")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user