2015-06-07 22:59:58 +02:00
<!-- [metadata]>
+++
title = "Command Completion"
description = "Compose CLI reference"
keywords = ["fig, composition, compose, docker, orchestration, cli, reference"]
[menu.main]
parent="smn_workw_compose"
weight=3
+++
<![end-metadata]-->
2014-12-25 11:16:45 +01:00
2015-04-22 11:53:02 +02:00
# Command Completion
2014-12-25 11:16:45 +01:00
2015-01-20 18:29:28 +01:00
Compose comes with [command completion ](http://en.wikipedia.org/wiki/Command-line_completion )
2015-04-22 11:53:02 +02:00
for the bash and zsh shell.
2014-12-25 11:16:45 +01:00
2015-04-22 11:53:02 +02:00
## Installing Command Completion
### Bash
2014-12-25 11:16:45 +01:00
Make sure bash completion is installed. If you use a current Linux in a non-minimal installation, bash completion should be available.
On a Mac, install with `brew install bash-completion`
2015-04-22 11:53:02 +02:00
Place the completion script in `/etc/bash_completion.d/` (`/usr/local/etc/bash_completion.d/` on a Mac), using e.g.
2015-06-19 07:42:18 +02:00
curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose --version | awk 'NR==1{print $NF}')/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose
2015-04-22 11:53:02 +02:00
2014-12-25 11:16:45 +01:00
Completion will be available upon next login.
2015-04-22 11:53:02 +02:00
### Zsh
Place the completion script in your `/path/to/zsh/completion` , using e.g. `~/.zsh/completion/`
mkdir -p ~/.zsh/completion
2015-06-19 07:42:18 +02:00
curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose --version | awk 'NR==1{print $NF}')/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose
2015-04-22 11:53:02 +02:00
Include the directory in your `$fpath` , e.g. by adding in `~/.zshrc`
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
2015-05-07 12:22:11 +02:00
2014-12-25 11:16:45 +01:00
Depending on what you typed on the command line so far, it will complete
2015-01-20 18:29:28 +01:00
- available docker-compose commands
2014-12-25 11:16:45 +01:00
- options that are available for a particular command
2015-01-20 18:29:28 +01:00
- service names that make sense in a given context (e.g. services with running or stopped instances or services based on images vs. services based on Dockerfiles). For `docker-compose scale` , completed service names will automatically have "=" appended.
- arguments for selected options, e.g. `docker-compose kill -s` will complete some signals like SIGHUP and SIGUSR1.
2014-12-25 11:16:45 +01:00
2015-01-20 18:44:48 +01:00
Enjoy working with Compose faster and with less typos!
2015-02-25 09:43:33 +01:00
## Compose documentation
2015-06-16 05:52:55 +02:00
- [User guide ](/ )
2015-05-12 13:44:43 +02:00
- [Installing Compose ](install.md )
- [Get started with Django ](django.md )
- [Get started with Rails ](rails.md )
- [Get started with Wordpress ](wordpress.md )
2015-02-25 09:43:33 +01:00
- [Command line reference ](cli.md )
- [Yaml file reference ](yml.md )
2015-06-19 07:42:18 +02:00
- [Compose environment variables ](env.md )