Install Docker Machine

 

Install Docker Machine binaries by following the instructions in the following section. You can find the latest versions of the binaries on the docker/machine release page on GitHub.

Install Docker Machine

  1. Install Docker.

  2. Download the Docker Machine binary and extract it to your PATH.

    If you are running macOS:

     
 base=https://github.com/docker/machine/releases/download/v0.16.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 Linux:

 
 base=https://github.com/docker/machine/releases/download/v0.16.0 \
  && curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine \
  && sudo mv /tmp/docker-machine /usr/local/bin/docker-machine \
  && chmod +x /usr/local/bin/docker-machine

If you are running Windows with Git BASH:

 
  •  base=https://github.com/docker/machine/releases/download/v0.16.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"
    

    The above command works on Windows only if you use a terminal emulator such as Git BASH, which supports Linux commands like chmod.

    Otherwise, download one of the releases from the docker/machine release page directly.

  • Check the installation by displaying the Machine version:

     
 docker-machine version

Install bash completion scripts

The Machine repository supplies several bash scripts that add features such as:

  • command completion
  • a function that displays the active machine in your shell prompt
  • a function wrapper that adds a docker-machine use subcommand to switch the active machine

Confirm the version and save scripts to /etc/bash_completion.d or /usr/local/etc/bash_completion.d:

base=https://raw.githubusercontent.com/docker/machine/v0.16.0
for i in docker-machine-prompt.bash docker-machine-wrapper.bash docker-machine.bash
do
  sudo wget "$base/contrib/completion/bash/${i}" -P /etc/bash_completion.d
done

Then you need to run source /etc/bash_completion.d/docker-machine-prompt.bash in your bash terminal to tell your setup where it can find the file docker-machine-prompt.bash that you previously downloaded.

To enable the docker-machine shell prompt, add $(__docker_machine_ps1) to your PS1 setting in ~/.bashrc.

PS1='[\u@\h \W$(__docker_machine_ps1)]\$ '

You can find additional documentation in the comments at the top of each script.

How to uninstall Docker Machine

To uninstall Docker Machine:

  • Optionally, remove the machines you created.

    To remove each machine individually: docker-machine rm <machine-name>

    To remove all machines: docker-machine rm -f $(docker-machine ls -q) (you might need to use -force on Windows).

    Removing machines is an optional step because there are cases where you might want to save and migrate existing machines to a Docker for Mac or Docker Desktop for Windows environment, for example.

  • Remove the executable: rm $(which docker-machine)

Note

As a point of information, the config.json, certificates, and other data related to each virtual machine created by docker-machine is stored in ~/.docker/machine/machines/ on Mac and Linux and in ~\.docker\machine\machines\ on Windows. We recommend that you do not edit or remove those files directly as this only affects information for the Docker CLI, not the actual VMs, regardless of whether they are local or on remote servers.

 

 base=https://github.com/docker/machine/releases/download/v0.16.0 \
  && curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine \
  && sudo mv /tmp/docker-machine /usr/local/bin/docker-machine \
  && chmod +x /usr/local/bin/docker-machine
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值