about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-10-08 18:14:24 +0200
committerEmile <hanemile@protonmail.com>2019-10-08 18:14:24 +0200
commit3cf0c5db38d0568400859f3bffd34ae07bdf28fe (patch)
tree0bd6c92bbde0b9eac7ee495d22025f874093c52b
parent23b1df31df8d408c3008d57f1cd7cdcc12be832e (diff)
exposing the container using traefik labels
-rw-r--r--src/docker.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/docker.go b/src/docker.go
index d1d9051..c949815 100644
--- a/src/docker.go
+++ b/src/docker.go
@@ -53,13 +53,16 @@ func spawnCompanion(username string, accesscode string) {
 	Config := &container.Config{
 		Image: "circus-companion:latest",
 		Cmd:   []string{"-username", username, "-accessCode", accesscode, "-sessionSalt", sessionSalt, "-vpnRemoteAddress", vpnRemoteAddress, "-vpnRemotePort", vpnRemotePort},
-
+		ExposedPorts: nat.PortSet{
+			"8080/tcp": struct{}{},
+		},
 		// Container labels used by traefik
 		Labels: map[string]string{
 			"traefik.enable": "true",
-			"traefik.http.routers.companion.entrypoints":               "web",
-			"traefik.http.routers.companion.rule":                      "Host(`companion.docker.localhost`)",
-			"traefik.http.services.companion.loadbalancer.server.port": "8080",
+			fmt.Sprintf("traefik.http.routers.%s.entrypoints", username):               "web",
+			fmt.Sprintf("traefik.http.routers.%s.rule", username):                      fmt.Sprintf("Host(`%s.docker.localhost`)", username),
+			fmt.Sprintf("traefik.http.services.%s.loadbalancer.server.port", username): "8080",
+			"traefik.docker.network": "circus",
 		},
 	}