From 529960d5ef150c7325e771c263209c323df474d9 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 3 Apr 2018 20:25:39 +0200 Subject: [PATCH] Docker for Machine: update (#6364) --- docker-for-mac/docker-toolbox.md | 26 ++++++------- docker-for-mac/index.md | 2 +- machine/install-machine.md | 63 ++++++++++++++++++++------------ 3 files changed, 51 insertions(+), 40 deletions(-) diff --git a/docker-for-mac/docker-toolbox.md b/docker-for-mac/docker-toolbox.md index 188d5c0768..03469f4297 100644 --- a/docker-for-mac/docker-toolbox.md +++ b/docker-for-mac/docker-toolbox.md @@ -33,7 +33,7 @@ This setup is shown in the following diagram. Docker for Mac is a Mac native application, that you install in `/Applications`. At installation time, it creates symlinks in `/usr/local/bin` for `docker` and -`docker-compose`, to the version of the commands inside the Mac application +`docker-compose` and others, to the commands in the application bundle, in `/Applications/Docker.app/Contents/Resources/bin`. Here are some key points to know about Docker for Mac before you get started: @@ -44,13 +44,10 @@ Here are some key points to know about Docker for Mac before you get started: Hypervisor.framework in macOS 10.10 Yosemite and higher. * When you install Docker for Mac, machines created with Docker Machine are - not affected. The Docker for Mac detects and offers to copy containers and - images from your local `default` machine (if one exists) to the new - Docker for Mac HyperKit VM. If you choose to do this, the image is copied, - but the original `default` machine is still kept exactly as it was. + not affected. -* Docker for Mac application does not use `docker-machine` to provision - the Hyperkit-based VM it uses. The Docker Engine API is exposed on a +* Docker for Mac does not use `docker-machine` to provision its VM. + The Docker Engine API is exposed on a socket available to the Mac host at `/var/run/docker.sock`. This is the default location Docker and Docker Compose clients use to connect to the Docker daemon, so you to use `docker` and `docker-compose` CLI commands @@ -83,7 +80,7 @@ coexistence](docker-toolbox.md#docker-toolbox-and-docker-for-mac-coexistence). If this command returns no output, you are ready to use Docker for Mac. - If it returns output (as shown in the example), you need to unset + If it returns output (as shown in the example), unset the `DOCKER` environment variables to make the client talk to the Docker for Mac Engine (next step). @@ -183,15 +180,14 @@ machines. One solution is to use a version manager like ## Migrating from Docker Toolbox to Docker for Mac -Docker for Mac does not propose Toolbox image migration as part of the Docker -for Mac installer since version 18.01.0. You can migrate existing Docker -Toolbox images with the scripts described below. (Note that this migration -cannot merge images from both Docker and Toolbox: any existing Docker image are +Docker for Mac does not propose Toolbox image migration as part of its +installer since version 18.01.0. You can migrate existing Docker +Toolbox images with the scripts described below. (This migration +cannot merge images from both Docker and Toolbox: any existing Docker image is *replaced* by the Toolbox images.) -To run these instructions you need to now how to run shell commands in a -terminal. You also need a working `qemu-img`; it is part of the qemu package in -both MacPorts and Brew: +Run the following shell commands in a terminal. You need a working +`qemu-img`; it is part of the qemu package in both MacPorts and Brew: ```sh $ brew install qemu # or sudo port install qemu diff --git a/docker-for-mac/index.md b/docker-for-mac/index.md index 891c8c8c09..7f506471a1 100644 --- a/docker-for-mac/index.md +++ b/docker-for-mac/index.md @@ -98,7 +98,7 @@ Choose ![whale menu](images/whale-x.png){: .inline} -> **Preferences** from the ![Preferences](images/menu/prefs-general.png){:width="400px"} -Gneral settings are: +General settings are: - **Start Docker when you log in**: Uncheck this option if you don't want Docker to start when you open your session. diff --git a/machine/install-machine.md b/machine/install-machine.md index 0fcf8f17b6..6d9a9e5740 100644 --- a/machine/install-machine.md +++ b/machine/install-machine.md @@ -24,23 +24,26 @@ on GitHub. If you are running on **macOS**: ```console - $ curl -L https://github.com/docker/machine/releases/download/v{{site.machine_version}}/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine && \ - chmod +x /usr/local/bin/docker-machine + $ base=https://github.com/docker/machine/releases/download/v{{site.machine_version}} && + 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**: ```console - $ curl -L https://github.com/docker/machine/releases/download/v{{site.machine_version}}/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && \ - sudo install /tmp/docker-machine /usr/local/bin/docker-machine + $ base=https://github.com/docker/machine/releases/download/v{{site.machine_version}} && + 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](https://git-for-windows.github.io/){: target="_blank" class="_"}: ```console - $ if [[ ! -d "$HOME/bin" ]]; then mkdir -p "$HOME/bin"; fi && \ -curl -L https://github.com/docker/machine/releases/download/v{{site.machine_version}}/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" && \ -chmod +x "$HOME/bin/docker-machine.exe" + $ base=https://github.com/docker/machine/releases/download/v{{site.machine_version}} && + 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 @@ -69,36 +72,48 @@ Confirm the version and save scripts to `/etc/bash_completion.d` or `/usr/local/etc/bash_completion.d`: ```bash -scripts=( docker-machine-prompt.bash docker-machine-wrapper.bash docker-machine.bash ); for i in "${scripts[@]}"; do sudo wget https://raw.githubusercontent.com/docker/machine/v{{site.machine_version}}/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. +base=https://raw.githubusercontent.com/docker/machine/v{{site.machine_version}} +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 ``` -To enable the `docker-machine` shell -prompt, add `$(__docker_machine_ps1)` to your `PS1` setting in `~/.bashrc`. +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](https://github.com/docker/machine/tree/master/contrib/completion/bash){: target="_blank" class="_"}. +You can find additional documentation in the comments at the [top of +each +script](https://github.com/docker/machine/tree/master/contrib/completion/bash){: +target="_blank" class="_"}. ## How to uninstall Docker Machine To uninstall Docker Machine: -* Remove the executable: `rm $(which docker-machine)` - * Optionally, remove the machines you created. - To remove each machine individually: `docker-machine rm ` + To remove each machine individually: `docker-machine rm ` - To remove all machines: `docker-machine rm -f $(docker-machine ls -q)` (you might need to use `-force` on Windows) + 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](/docker-for-mac/index.md) or [Docker for + Windows](/docker-for-windows/index.md) environment, for example. + +* Remove the executable: `rm $(which docker-machine)` - 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](/docker-for-mac/index.md) or [Docker for - Windows](/docker-for-windows/index.md) environment, for example. >**Note**: As a point of information, the `config.json`, certificates, and other data related to each virtual machine created by `docker-machine` @@ -110,8 +125,8 @@ servers. ## Where to go next -- [Docker Machine overview](overview.md) -- Create and run a Docker host on your [local system using virtualization](get-started.md) -- Provision multiple Docker hosts [on your cloud provider](get-started-cloud.md) +- [Docker Machine overview](overview.md) +- Create and run a Docker host on your [local system using virtualization](get-started.md) +- Provision multiple Docker hosts [on your cloud provider](get-started-cloud.md) - [Docker Machine driver reference](/machine/drivers/index.md) - [Docker Machine subcommand reference](/machine/reference/index.md)