Docker sq
Docker Fundamentals - Installing Docker

Creating Docker Machines


Creating Docker Machines

In the last video, you learned about Docker Machine and that you will have to use a Docker machine if you're using the Docker Toolbox. Docker machine can also be handy if you're using Docker for Windows or Mac or a classic Docker installation. It allows you to easily set up the Docker engine on another system. Depending on how you install Docker, you might have to manually install the Docker Machine. It ships with Docker for Mac, Docker for Windows and the Docker Toolbox. In other cases, you might have to install it manually.

Getting Started

Start by listing the Docker machines we currently have: docker-machine ls. There is a machine named “default”. We can add additional Docker machines with docker-machine create and then the name of the machine. For example, docker-machine create node1. This would install another virtual machine using Virtualbox. Docker machine supports usage of drivers, which means we can specify an additional driver here, like VMware Fusion. VMware Fusion is another hypervisor just like virtualbox. This command performs a bunch of steps. It will set up a virtual machine, download an operating system, and install it inside that virtual machine. It will also make sure that the docker engine runs inside the VM and that we can access it.

Starting up the new machine

If we now run docker-machine ls, you can see that we have two Docker machines. Our default Docker machine using the virtualbox driver,and node1 which runs on VMware Fusion. If we want to point our Docker client to node1, we run docker-machine env node1 and then copy the commands eval $(docker-machine env node 1). You can use a docker-machine start/stop command to manage the VM.

Docker Machine supports a lot of drivers, and you can get an overview of them in the manual. Not only can it install Docker inside of a virtual machine, but it can also install on a cloud service like AWS or Digital Ocean. Docker Machine is really a handy tool, and if at some point you find a need to install an additional Docker engine, to test something, or just to get a fresh start, think about using Docker Machine. It's not something that I would use in production but for testing or development purposes, it is an excellent choice.

A lot of the drivers support additional options, for example on the VMware Fusion driver, we can control how much memory and CPUs we give the virtual machine. Make sure to check out the manual if you intend to use Docker Machine.


I finished! On to the next chapter