(VirtualBox on Mac OS X)
This guide is a combination of official docs and usage experience.
Install virtualbox first virtualbox downloads.
Look at this page: https://github.com/docker/machine/releases/ and pick latest
release. At the time of writing this is
Now, assign version number to an environment variable, together with your architecture:
docker-machine binary and put it onto your
1 2 3 4 5
If you still haven’t yet, put
~/bin/ on your
PATH=$PATH:$HOME/bin into your
.zshrc (or whatever shell you
Installing docker client
1 2 3 4
Creating your first docker machine
This is how you create docker machine with name
dev having virtualbox as a
But after some time you will encounter a problem of running out of memory. So my recommended command to create your primary development docker machine is this:
This will create virtualbox VM with enough memory to run low-to-moderate size
docker-compose. Which should be enough for development.
This should be your primary docker machine that is always activated and used.
There is no need to destroy and re-create this
dev machine unless you are
testing some edge-cases. And better to use additional docker machine with
different name for this.
Connecting to your
dev docker machine
After this command, you will have everything you need to run
docker in the same terminal:
You should see:
It might be annoying to run
eval $(docker-machine env dev) each time you open
new terminal. So feel free to put this line into your
whatever shell you use:
If you have just powered on your Mac (or just stopped your docker machine) you will experience this error:
In that case just start it with:
And re-open your terminal.
Dealing with docker machine’s IP address
Fact: docker machine’s IP address stays the same, usually 192.168.99.100, unless:
- you destroy your docker machine
dev, create another VirtualBox VM and create docker machine
- you have custom VirtualBox configuration.
Given that docker machine’s IP address stays the same or changes very rarely,
you can simply put its IP address in your
First, figure out current docker machine’s IP address:
And put it in
1 2 3 4
To test that it works correclty try to run:
And now reach
http://docker-dev in your browser - you should see default
If you want to refer docker machine
dev in your scripts, it is better to use
$(docker-machine ip dev) capabilities for that. For example,
page we have seen in browser just now:
For teams it would make sense to agree on the same name for primary development
dev works just great!
NOTE: personally, I use both
docker-dev and just
dev as a hostname to type
less, but that might clash with something else, so
docker-dev it is.
docker binaries, just follow
docker server inside of already running docker machine, use:
This will update to the latest version of
docker server and
Re-creating a fresh
dev docker machine
Comments on hackernews.
Happy hacking! @tdd_fellow on twitter.