Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.