Installation instructions available on the Docker documentation site.
$ docker rm build-osx-installer;true &&\
docker build -t osx-installer . &&\
docker run --privileged -i -t --name build-osx-installer osx-installer &&\
docker cp build-osx-installer:/dmg/Docker.pkg .