Cloudsql-proxy: Custom alpine image throws error "x509: certificate signed by unknown authority"

Created on 5 Nov 2019  路  2Comments  路  Source: GoogleCloudPlatform/cloudsql-proxy

I'm trying to build a custom image with the cloud sql proxy v1.16 because I need a shell, but I got some certs issues

Get https://www.googleapis.com/sql/v1beta4/projects/<my project>/instances/<my instance>?alt=json&prettyPrint=false: oauth2: cannot fetch token: Post https://oauth2.googleapis.com/token: x509: certificate signed by unknown authority

My Dockerfile looks like this:

FROM alpine:3.10

RUN wget -O /cloud_sql_proxy https://storage.googleapis.com/cloudsql-proxy/v1.16/cloud_sql_proxy.linux.386 &&  chmod +x /cloud_sql_proxy

ADD key.json /run/secrets/GCE_CONFIG

CMD ["sh", "-c", "./cloud_sql_proxy -instances=<my instance>=tcp:0.0.0.0:1111 
-credential_file=/run/secrets/GCE_CONFIG" ]

Please help me out on how to add the certs to my docker image and make this work.

question

Most helpful comment

It looks like you are just missing ca-ceritficates, since alpine doesn't include them in the image. Try adding the following in your Dockerfile:

RUN apk add --no-cache ca-certificates && update-ca-certificates

All 2 comments

It looks like you are just missing ca-ceritficates, since alpine doesn't include them in the image. Try adding the following in your Dockerfile:

RUN apk add --no-cache ca-certificates && update-ca-certificates

Thank you @kurtisvg :100:

Was this page helpful?
0 / 5 - 0 ratings