Skip to content

Instantly share code, notes, and snippets.

@irgeek
Created January 22, 2015 00:14
Show Gist options
  • Save irgeek/afb2e05775fff532f960 to your computer and use it in GitHub Desktop.
Save irgeek/afb2e05775fff532f960 to your computer and use it in GitHub Desktop.
#!/bin/sh
BOOT2DOCKER_CERTS_DIR=/var/lib/boot2docker/certs
CERTS_DIR=/etc/ssl/certs
CAFILE=${CERTS_DIR}/ca-certificates.crt
for cert in $(/bin/ls -1 ${BOOT2DOCKER_CERTS_DIR}); do
SRC_CERT_FILE=${BOOT2DOCKER_CERTS_DIR}/${cert}
CERT_FILE=${CERTS_DIR}/${cert}
HASH_FILE=${CERTS_DIR}/$(/usr/local/bin/openssl x509 -noout -hash -in ${SRC_CERT_FILE} 2>/dev/null)
[ ! -L ${CERT_FILE} ] && /bin/ln -fs ${SRC_CERT_FILE} ${CERT_FILE}
for idx in $(/usr/bin/seq 0 9); do
if [ -L ${HASH_FILE}.${idx} ]; then
[ "$(/usr/bin/readlink ${HASH_FILE}.${idx})" = "${SRC_CERT_FILE}" ] && break
else
/bin/ln -fs ${SRC_CERT_FILE} ${HASH_FILE}.${idx}
break
fi
done
/bin/cat ${SRC_CERT_FILE} >> ${CAFILE}
done
@gideonairex
Copy link

Thanks!

@jrodriguezjr
Copy link

Nice work! WFM too!

@hudgins
Copy link

hudgins commented Apr 21, 2015

Worked here as well, thanks a lot!

@2rs2ts
Copy link

2rs2ts commented Jun 12, 2015

FYI: with boot2docker 1.6.2 I don't need to append the files to ca-certificates.crt, they are getting automatically appended.

@lordkada
Copy link

Great!

@ChezCrawford
Copy link

@irgeek: You are my HERO. Thank you for this.

@Datenheld
Copy link

Thanks a lot. I was close to giving up.

Copy link

ghost commented May 28, 2016

@irgeek: Thank you. It helped a lot.

@oeegee
Copy link

oeegee commented Aug 9, 2016

@irgeek: Great. Thank you!

@rpomeroy
Copy link

If I'm using docker-machine on Windows (10) - how do I integrate this solution? Does this go in ~/.docker/... somewhere so it's persisted across restarts?

Thanks - Ron

@lukecampbell
Copy link

IT WORKS!!!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment