sudo: docker-machine: command not found

Viewed 66986

who has ever tried following this tutorial about Docker Swarm?

https://docs.docker.com/get-started/part4/

There is a section called : Create a cluster. What I wanted to do was to create a couple of VMs using docker-machine. Since I use ubuntu16.0.4 so I used following commands to get VirtualBox.

sudo apt-get update
sudo apt-get install virtualbox-5.2

After I installed VirtualBox, typed a command like :

docker-machine create --driver virtualbox myvm1

But it says : sudo: docker-machine: command not found

So I typed another command to check if I have installed VirtualBox correctly.

sudo virtualbox version

This opens the Oracle VM VirtualBox Manager, which means I did install VirtualBox correctly , but not sure.

Could anyone help me with a proper solution? Any help would be appreciated.

5 Answers

The accepted answer contains outdated install instructions!

Up to date instructions for Docker Machine can be found in the official documentation here. This includes instructions for MacOS, Linux (including Ubuntu) & Windows with Git BASH. Full documentation can be found here.

While @sdey0081's answer is more or less correct, running the posted commands will result in an outdated version of Docker Machine being installed. The version it installs is v0.13.0 while the current release at the time of writing is v0.15.0. You can find the available releases in the GitHub repo here.

On MacOS installing with brew is the simplest solution: brew install docker-machine

Just additional information with steps to the main answer:

1) To install docker-machine you need to write this as mantioned @coturiv:

$ curl -L https://github.com/docker/machine/releases/download/v0.16.1/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine &&
    chmod +x /tmp/docker-machine &&
    sudo cp /tmp/docker-machine /usr/local/bin/docker-machine

2) If you get the error after running the command docker-machine create:

Error creating machine: Error with pre-create check: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path

be sure that you also installed virtualbox:

sudo apt-get install virtualbox

3) If you get again the error like:

This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory 

try to run the command docker-machine create using --virtualbox-no-vtx-check like:

docker-machine create default --virtualbox-no-vtx-check

https://docs.docker.com/machine/ :

Docker Machine has been deprecated. Please use Docker Desktop instead. See Docker Desktop for Mac and Docker Desktop for Windows. You can also use other cloud provisioning tools.

Related