Skip to content

Instantly share code, notes, and snippets.

@ogavrisevs
Last active January 7, 2016 08:52
Show Gist options
  • Save ogavrisevs/1a1e8439fb324ea30fe9 to your computer and use it in GitHub Desktop.
Save ogavrisevs/1a1e8439fb324ea30fe9 to your computer and use it in GitHub Desktop.
Access Docker API (docker-machine) with curl on Mac
#! /bin/bash
docker_machine_name="dev"
password="qwerty123"
ip=$(docker-machine ip $docker_machine_name)
openssl pkcs12 -export -in ~/.docker/machine/machines/$docker_machine_name/server.pem -inkey ~/.docker/machine/machines/$docker_machine_name/server-key.pem -out ~/.docker/machine/machines/$docker_machine_name/cert.pfx -password pass:$password
curl --cacert ~/.docker/machine/machines/$docker_machine_name/server.pem --cert ~/.docker/machine/machines/$docker_machine_name/cert.pfx --pass $password https://$ip:2376/version | jq .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment