Files
docker-docs/machine/completion.md
Misty Stanley-Jones a4f5e30249 Various copyedits to reduce future tense, wordiness, and use of 'please' (#5788)
* Reword lots of instances of 'will'

* Reword lots of instances of won't

* Reword lots of instances of we'll

* Eradicate you'll

* Eradicate 'be able to' type of phrases

* Eradicate 'unable to' type of phrases

* Eradicate 'has / have to' type of phrases

* Eradicate 'note that' type of phrases

* Eradicate 'in order to' type of phrases

* Redirect to official Chef and Puppet docs

* Eradicate gratuitous 'please'

* Reduce use of e.g.

* Reduce use of i.e.

* Reduce use of N.B.

* Get rid of 'sexagesimal' and correct some errors
2018-01-25 17:37:23 -08:00

2.2 KiB

description, keywords, title
description keywords title
Install Machine command-line completion machine, docker, orchestration, cli, reference Command-line completion

Docker Machine comes with command completion for the bash and zsh shell.

Installing Command Completion

Bash

Make sure bash completion is installed. If you are using a current version of Linux in a non-minimal installation, bash completion should be available.

On a Mac, install with brew install bash-completion.

Place the completion script in /etc/bash_completion.d/ as follows:

  • On a Mac:

    sudo curl -L https://raw.githubusercontent.com/docker/machine/v{{site.machine_version}}/contrib/completion/bash/docker-machine.bash -o `brew --prefix`/etc/bash_completion.d/docker-machine
    
  • On a standard Linux installation:

    sudo curl -L https://raw.githubusercontent.com/docker/machine/v{{site.machine_version}}/contrib/completion/bash/docker-machine.bash -o /etc/bash_completion.d/docker-machine
    

Completion is available upon next login.

Zsh

Place the completion script in your a completion file within the ZSH configuration directory, such as ~/.zsh/completion/.

mkdir -p ~/.zsh/completion
curl -L https://raw.githubusercontent.com/docker/machine/v{{site.machine_version}}/contrib/completion/zsh/_docker-machine > ~/.zsh/completion/_docker-machine

Include the directory in your $fpath, by adding a like the following to the ~/.zshrc configuration file.

fpath=(~/.zsh/completion $fpath)

Make sure compinit is loaded or do it by adding in ~/.zshrc:

autoload -Uz compinit && compinit -i

Then reload your shell:

exec $SHELL -l

Available completions

Depending on what you typed on the command line so far, it completes:

  • commands and their options
  • container IDs and names
  • image repositories and image tags
  • file paths

Where to go next