INNER CODE UNIT · Go
main
Netis/cloud-probe · cptools/dockerpid/main.go:13
func main() {
if len(os.Args) != 2 {
fmt.Fprintf(os.Stderr, "Usage: %s <containerId>\n", os.Args[0])
fmt.Fprintf(os.Stderr, "Example: %s abc123def456\n", os.Args[0])
os.Exit(1)
}
containerID := os.Args[1]
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
// Negotiate the API version manually instead of relying on the client's
// built-in negotiation. The moby client (v0.4.x) refuses to negotiate below
// API 1.40, so against old daemons (e.g. Docker on CentOS 7 / older k8s
// nodes, whose max API can be 1.39 or lower) it falls back to its own max
// version (1.54) and the daemon rejects the request as "too new".
//