Quicker switching of active docker machines

fbbb494a7eef5f9278c6967b6072ca3e_400x400           machines

As it stands today, with the docker machine command you have to manually specify environment variables for DOCKER_HOST and DOCKER_AUTH.

So the process would be:

This is a bit of a pain when doing it manually, so I was looking for a quicker way to switch back and forth and I think this works pretty well, though not totally elegant.

I started with a shell script which contains the following.  It takes the machine name as input, outputs the syntax to a script and sources it.   I found I had to do it this way, otherwise the current user session wouldn’t have the variables changed, only for the script itself.

So you would run it with:

Let me know if you have a better way!

Tagged , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *