Skip to content

Instantly share code, notes, and snippets.

@toschneck
Last active April 2, 2024 12:41
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save toschneck/2df90c66e0f8d4c6567d69a36bfc5bcd to your computer and use it in GitHub Desktop.
Save toschneck/2df90c66e0f8d4c6567d69a36bfc5bcd to your computer and use it in GitHub Desktop.
Install Docker and Docker-Compose bash completion
#!/usr/bin/env bash
set -e
echo "install docker bash completion"
curl -L https://raw.githubusercontent.com/docker/docker/v$(docker version --format '{{.Server.Version}}')/contrib/completion/bash/docker -o /etc/bash_completion.d/docker
echo "install docker-compose bash completion"
curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
echo ".... done!"
@frankitox
Copy link

The first link is broken, looks like the completion file now sits in the docker/cli repo. Here's the updated URL:

https://raw.githubusercontent.com/docker/cli/v$(docker version --format '{{.Server.Version}}' | sed 's/-.*//')/contrib/completion/bash/docker

Note I pipped sed to remove anything after the hyphen on the version number. E.g: 19.03.13-ce -> 19.03.13.

@kamal2222ahmed
Copy link

nstall docker-compose bash completion
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 14 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Failed to create the file /etc/bash_completion.d/docker-compose: No
Warning: such file or directory
100 14 100 14 0 0 90 0 --:--:-- --:--:-- --:--:-- 89
curl: (23) Failed writing body (0 != 14)

@mossad-zika
Copy link

dolboeb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment