docker ca certificate for private registry on osx

Docker has changed to ssl as from v1.3.1. But until now I could not use it with local / on-premise docker registries and had to fall-back to –insecure options.
Today I read a docker issue at 805 and the last comment of ‘rossbachp’ gave the solution.

Get your hand on the public CA key part of your self signed server key. That is the one you have used to sign your self signed certificate for your server.
Create inside your boot2docker ‘boot2docker ssh’ a directory named after the private registry you want to access:
boot2docker ssh
sudo su -
cd /var/lib/boot2docker
mkdir registry.acme.org
cd registry.acme.org
cp /from/some/location/ca.pem .

Create a script in /var/lib/boot2docker/bootlocal.sh

#!/bin/bash
cat /var/lib/boot2docker/registry.acme.org/ca.pem >> /etc/ssl/cacert.pem

Now you can push your docker images to your on-premise docker registry.