Created
April 24, 2017 13:31
-
-
Save ChristianKniep/fe18c2a0f8877da829b1523f304279f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/docker/docker/client" | |
"github.com/docker/docker/api/types" | |
"golang.org/x/net/context" | |
"encoding/json" | |
"fmt" | |
) | |
const ( | |
dockerHost = "unix:///var/run/docker.sock" | |
dockerAPI = "v1.29" | |
cID = "8e97d5bc9703" | |
) | |
func main() { | |
cli, _ := client.NewClient(dockerHost, dockerAPI, nil, nil) | |
cj, b, _ := cli.ContainerInspectWithRaw(context.Background(), cID, false) | |
fmt.Printf("cj.State: %v\n", cj.State) | |
var cnt types.Container | |
json.Unmarshal(cj, &cnt) | |
fmt.Printf("cnt.State: %v\n", cnt.State) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment