-
-
Save nicolaka/e252facc2b328a811c2b to your computer and use it in GitHub Desktop.
This file contains 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 | |
while [[ $# -gt 1 ]] | |
do | |
case "$1" in | |
-f | --file) | |
file="$2" | |
shift 2 | |
;; | |
-h | --hostname) | |
hostname="$2" | |
shift 2 | |
;; | |
-*) | |
echo "Error: Unknown option: $1" >&2 | |
exit 1 | |
;; | |
*) # No more options | |
break | |
;; | |
esac | |
done | |
if ! [ -n "${file:+1}" ]; then | |
echo "Must set -f or --file with path to CA cert" | |
exit 1 | |
fi | |
if ! [ -n "${hostname:+1}" ]; then | |
echo "Must set -h or --host with docker-machine hostname" | |
exit 1 | |
fi | |
docker-machine scp ${file} ${hostname}:dtr-ca.pem | |
docker-machine ssh ${hostname} sudo mv dtr-ca.pem /var/lib/boot2docker/dtr-ca.pem | |
docker-machine ssh ${hostname} 'echo "#!/bin/sh" | sudo tee /var/lib/boot2docker/bootlocal.sh' | |
docker-machine ssh ${hostname} 'echo "cat /var/lib/boot2docker/dtr-ca.pem >> /etc/ssl/certs/ca-certificates.crt" | sudo tee -a /var/lib/boot2docker/bootlocal.sh' | |
docker-machine ssh ${hostname} sudo chmod +x /var/lib/boot2docker/bootlocal.sh | |
docker-machine restart ${hostname} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment