From 0bcd3ec73c1649c8e687b1930c16a2d1b831fb50 Mon Sep 17 00:00:00 2001 From: Emile Date: Mon, 7 Oct 2019 11:51:15 +0200 Subject: mounting the docker-socket --- src/docker.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/docker.go') diff --git a/src/docker.go b/src/docker.go index 846a77e..71075c6 100644 --- a/src/docker.go +++ b/src/docker.go @@ -6,6 +6,7 @@ import ( "os" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/network" "github.com/docker/docker/client" ) @@ -33,14 +34,13 @@ func setupDockerCLI() (err error) { return err } -func spawnCompanion(username string) string { +func spawnCompanion(username string, accesscode string) string { log.Println("Spwaning a new companion container") // setup the context and the docker cli connection setupContext() setupDockerCLI() Config := &container.Config{ - // docker socket // companion seed Image: "circus-companion:latest", // @@ -54,6 +54,14 @@ func spawnCompanion(username string) string { HostConfig := &container.HostConfig{ // ports (nat.PortMap) + // docker socket + Mounts: []mount.Mount{ + { + Type: mount.TypeBind, + Source: "/var/run/docker.sock", + Target: "/var/run/docker.sock", + }, + }, } NetworkingConfig := &network.NetworkingConfig{ -- cgit 1.4.1