Installing Docker Machine
On MacOS and Windows, when you install Docker for MAC, Docker for Windows or Docker Toolbox, machine is installed with other Docker products.
If you only need Docker machine, you can follow the instructions in the next section to install the machine binaries directly. The latest version of the binaries can be found on the Docker/machine publishing page on GitHub.
Direct mounting of the machine
Install Docker.
Download and unzip the Docker machine binary file to path.
If you're running on MacOS:
$ base=https://github.com/docker/machine/releases/download/v0.14.0 && curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-machine && chmod +x /usr/local/bin/docker-machine
If you are running on Linux:
$ base=https://github.com/docker/machine/releases/download/v0.14.0 && curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine && sudo install /tmp/docker-machine /usr/local/bin/docker-machine
If you are running with Windows with GIT bash:
$ base=https://github.com/docker/machine/releases/download/v0.14.0 && mkdir -p "$HOME/bin" && curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" && chmod +x "$HOME/bin/docker-machine.exe"
These commands are only available for Windows when you use terminal emulators such as Git Bash, which supports Linux commands chmod
.
Otherwise, download one of the versions directly from the Docker/machine release page.
To check the installation by displaying the machine version:
$ docker-machine versiondocker-machine version 0.14.0, build 9371605
Install bash Completion script
The Machine resource library provides several bash
scripts to add the following features:
- Command complete
- A function that displays the active computer at the shell prompt
- A function wrapper, which adds a
docker-machine use
sub-command to switch the active machine
Confirm the version and save the script to /etc/bash_completion.d
or /usr/local/etc/bash_completion.d
:
base=https://raw.githubusercontent.com/docker/machine/v0.14.0for i in docker-machine-prompt.bash docker-machine-wrapper.bash docker-machine.bashdo sudo wget "$base/contrib/completion/bash/${i}" -P /etc/bash_completion.ddone
Then you need to source /etc/bash_completion.d/docker-machine-prompt.bash
run in the Bash terminal and tell your settings that it can find docker-machine-prompt.bash
the files you downloaded earlier.
To enable docker-machine
shell hints, add $(__docker_machine_ps1)
them to your PS1
settings ~/.bashrc
.
PS1=‘[\[email protected]\h \W$(__docker_machine_ps1)]\$ ‘
You can find other documents in the comments at the top of each script.
How to uninstall Docker machine
To uninstall Docker machine:
Optionally, delete the computer that you created.
To delete each machine individually:docker-machine rm <machine-name>
To remove all computers: ( docker-machine rm -f $(docker-machine ls -q)
You may need to -force
use it on Windows).
Removing a computer is an optional step, because in some cases, you may want to save and migrate your existing computer to a Docker for Mac or Docker for Windows environment.
To delete an executable file:rm $(which docker-machine)
Note: As an information point config.json
, the certificates and other data associated with each virtual machine created are docker-machine
stored on ~/.docker/machine/machines/
mac and Linux as well as ~\.docker\machine\machines\
on Windows. We recommend that you do not edit or delete these files directly, as this will only affect the information of the Docker CLI, without affecting the actual VMS, whether they are local or remote servers.
Docker-machine Command Installation