From 3cf0c5db38d0568400859f3bffd34ae07bdf28fe Mon Sep 17 00:00:00 2001 From: Emile Date: Tue, 8 Oct 2019 18:14:24 +0200 Subject: exposing the container using traefik labels --- src/docker.go | 11 +++++++---- 1 file 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", }, } -- cgit 1.4.1