From 5c2fbd5b08e3d637aedc97fe679aba029f50c024 Mon Sep 17 00:00:00 2001 From: Emile Date: Tue, 8 Oct 2019 00:15:34 +0200 Subject: getting the ip address of the container and printing it --- src/docker.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/docker.go b/src/docker.go index 1dda5b2..7dfe584 100644 --- a/src/docker.go +++ b/src/docker.go @@ -120,6 +120,16 @@ func spawnCompanion(username string, accesscode string) { connectContainerToNetwork(containerID, circusNetworkID) log.Println("Container added to the circus network") + + // Get IP Address of that container + inspectJSON, err := dockerCLI.ContainerInspect(dockerCtx, containerID) + if err != nil { + log.Println("inspectJsonErr: ", err) + } + + fmt.Println("---") + fmt.Printf("%#v", inspectJSON.NetworkSettings.Networks) + fmt.Printf("companion IP: %#v", inspectJSON.NetworkSettings.Networks["circus"].IPAddress) } func generateSessionSalt() string { -- cgit 1.4.1