-
-
Save gesellix/f34a3bf1c612f0c838b816602265a7ae to your computer and use it in GitHub Desktop.
inject custom certificate to docker-for-mac beta (1.12.0-rc4-beta20 build:10404)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -ne 2 ] || ! [ -d "$1" ]; then | |
echo "Usage: $0 /Path/To/Certificate CERT_NAME" >&2 | |
exit 1 | |
fi | |
# This assumes the cert is in the same directory as the script | |
source="$( cd $1 && pwd )" | |
# ca-certificate of the VM | |
destination=/etc/ssl/certs/ca-certificates.crt | |
# Send a new line to wake it up, then login as root with a blank password | |
cat <<HERE > ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty | |
root | |
HERE | |
# Give it a second to get logged in, copy the cert and log back out | |
cat <<HERE > ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty | |
mkdir -p $destination | |
cat $source/$2 >> $destination | |
service docker restart | |
exit | |
HERE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment