Q:

How can I update DOCKER_OPTS in docker-machine permanently

After update to docker-machine, I have no idea how to update DOCKER_OPTS in a local boot2docker docker-machine and save it permanently 
$ docker-machine ls
NAME   ACTIVE   DRIVER       STATE     URL                         SWARM
dev    *        virtualbox   Running   tcp://192.168.99.100:2376

I tried to ssh into vm with docker-machine ssh dev, and update /etc/docker/default. But the changes I made are dropped after restart VM with docker-machine restart dev. 

A:

If you'd simply like to pass arguments to docker, add them to EXTRA_ARGS in /var/lib/boot2docker/profile. For example:
EXTRA_ARGS='
--label provider=virtualbox
--insecure-registry=10.0.0.1:5000
'

The docker process is started via /etc/init.d/docker which sources /var/lib/boot2docker/profile. $EXTRA_ARGS is passed transparently to the docker process towards the end of start().

A:

As of docker-machine 0.5.0, the mirror can be provisioned with --engine-registry-mirror
docker-machine create -d virtualbox --engine-registry-mirror http://mirror.dockerhub.com dev

--engine-registry-mirror [--engine-registry-mirror option --engine-registry-mirror option]       Specify registry mirrors to use

