diff options
author | Emile <hanemile@protonmail.com> | 2019-10-08 00:15:34 +0200 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2019-10-08 00:15:34 +0200 |
commit | 5c2fbd5b08e3d637aedc97fe679aba029f50c024 (patch) | |
tree | 79dc27e92c0f38e5dc417ab9e81bd25ced3825e2 | |
parent | a280bf6cf496eed61c18cc1563c40836f5a6f93d (diff) |
getting the ip address of the container and printing it
-rw-r--r-- | src/docker.go | 10 |
1 files changed, 10 insertions, 0 deletions
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 { |