about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-10-07 11:51:15 +0200
committerEmile <hanemile@protonmail.com>2019-10-07 11:51:15 +0200
commit0bcd3ec73c1649c8e687b1930c16a2d1b831fb50 (patch)
tree828fff3a809faa3b138e2d1df150624e834b8862
parent40312795db4a60fb9879283d832dd55af8918536 (diff)
mounting the docker-socket
-rw-r--r--src/docker.go12
1 files changed, 10 insertions, 2 deletions
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{