I've a golang binary, which communicates with a remote docker daemon using TLS.The binary successfully runs on a local machine.But when running this binary in a docker ubuntu container the tls config fails. It is panicing with the following error
/usr/local/go/src/crypto/x509/cert_pool.go:96 +0x6b
crypto/x509.(*CertPool).AppendCertsFromPEM(0x0, 0xc4202bd4c8, 0x0, 0x200, 0xac8)
/usr/local/go/src/crypto/x509/cert_pool.go:128 +0x161
github.com/docker/go-connections/tlsconfig.certPool(0xc420240de0, 0x18, 0xc42018bc00, 0x51bbca, 0xc420240e20, 0x19)
/media/atom/lighthouse/gowork/src/github.com/docker/go-connections/tlsconfig/config.go:105 +0x283
github.com/docker/go-connections/tlsconfig.Client(0xc420240de0, 0x18, 0xc420240e00, 0x1a, 0xc420240e20, 0x19, 0x0, 0x0, 0x0, 0x0, ...)
/media/atom/lighthouse/gowork/src/github.com/docker/go-connections/tlsconfig/config.go:199 +0x25a
)
the binary uses the github.com/docker/docker/client
,the official docker golang SDK.
I can't tell why from what you've posted, but the stack trace from the following program looks suspiciously similar to what you're seeing. The solution is most likely making sure that your *x509.CertPool
can't be nil
package main
import (
"fmt"
"crypto/x509"
)
func main() {
var cp *x509.CertPool
cert := &x509.Certificate{}
cp.AddCert(cert)
fmt.Println("AddCert succeeded")
}