Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Installing bash completion scripts documentation #2529

Closed
lmeyemezu opened this issue Dec 8, 2015 · 15 comments
Closed

Installing bash completion scripts documentation #2529

lmeyemezu opened this issue Dec 8, 2015 · 15 comments

Comments

@lmeyemezu
Copy link

Hi,
documentation for (https://docs.docker.com/machine/install-machine/) for centos7 seems to be wrong.
bash_completion is not installed by default , so it's has to be specifiied.
stiil have error -bash: __docker-machine-ps1: command not found
Regards

@nickdgriffin
Copy link

It's because the function is actually called "__docker_machine_ps1".

@lmeyemezu
Copy link
Author

working fine now .
Good job 👍

@amingilani
Copy link

Same issue here with both Mac and Linux, running zsh

$(__docker_machine_ps1)
zsh: command not found: __docker_machine_ps1

@amingilani
Copy link

 gilani@debris  /etc/bash_completion.d  bash
gilani@debris:/etc/bash_completion.d$ $(__docker_machine_ps1)
__docker_machine_ps1: command not found
gilani@debris:/etc/bash_completion.d$ exit
exit
 ✘ gilani@debris  /etc/bash_completion.d  $(__docker_machine_ps1)
zsh: command not found: __docker_machine_ps1

@amingilani
Copy link

Checked on bash too, doesn't work there either. Linux is Ubuntu 14.04 based.

@aeternitatus
Copy link

having the same issue:
__docker_machine_ps1: command not found
on Ubuntu 16.04

@vingrad
Copy link

vingrad commented Jun 7, 2016

Debian 7.5
__docker_machine_ps1: command not found

@aeternitatus
Copy link

I've just commented it out in my etc/bash_completion.d/docker file:
# PS1='[\u@\h \W$(__docker_machine_ps1)]\$ '
otherwise it was pretty annoying to work with

@CormacBracken
Copy link

If you have the error __docker_machine_ps1: command not found, it means you need to tell your setup where it can find the file docker-machine-prompt.bash that you previously downloaded. For example in .bashrc, before the PS1 lines:

source /etc/bash_completion.d/docker-machine-prompt.bash

@leydisContre7777
Copy link

I'm having the same problem on Ubuntu 16.04 and I tried to declare the variable on ~/.bashrc:

__docker_machine_ps1=source '/etc/bash_completion.d/docker-machine-prompt.bash'

Probably I'm not doing the rigth way, but I don't know how to do this.

I hope somebody help me, thanks!

@IgorGanapolsky
Copy link

@nickdgriffin Actually, I have that, and am getting this error:

bash: __docker_machine_ps1: command not found

@rubyconvict
Copy link

This is in the docs: https://docs.docker.com/machine/install-machine/#installing-bash-completion-scripts. Try doing this:

sudo su
cd /etc/bash_completion.d/
wget https://raw.githubusercontent.com/docker/machine/v0.11.0/contrib/completion/bash/docker-machine-prompt.bash
wget https://raw.githubusercontent.com/docker/machine/v0.11.0/contrib/completion/bash/docker-machine-wrapper.bash
wget https://raw.githubusercontent.com/docker/machine/v0.11.0/contrib/completion/bash/docker-machine.bash
exit
# and reload the terminal

@ltfschoen
Copy link

ltfschoen commented Aug 28, 2017

I'm using macOS Sierra v10.12.6.

I added Bash Completion with the following steps thanks for @rubyconvict:

  • Install Bash Completion scripts. Replace version in URLs below with latest Docker Machine version https://github.com/docker/machine/releases.
    • Note: If Bash Completion already installed with Homebrew (check with brew list bash-completion) then use /etc/bash_completion.d/ instead of /usr/local/etc/bash_completion.d/ below:
    brew install wget
    sudo su
    cd /usr/local/etc/bash_completion.d/
    wget https://raw.githubusercontent.com/docker/machine/v0.12.2/contrib/completion/bash/docker-machine-prompt.bash
    wget https://raw.githubusercontent.com/docker/machine/v0.12.2/contrib/completion/bash/docker-machine-wrapper.bash
    wget https://raw.githubusercontent.com/docker/machine/v0.12.2/contrib/completion/bash/docker-machine.bash
    exit
    
  • Append to ~/.bashrc.
    echo 'source /usr/local/etc/bash_completion.d/docker-machine-prompt.bash' >> ~/.bashrc;
    echo 'source /usr/local/etc/bash_completion.d/docker-machine-wrapper.bash' >> ~/.bashrc;
    echo 'source /usr/local/etc/bash_completion.d/docker-machine.bash' >> ~/.bashrc;
    echo 'PS1="[\u@\h \W$(__docker_machine_ps1)]\$ "' >> ~/.bashrc;
    source ~/.bashrc;
    cat ~/.bashrc;
    

@simendavid
Copy link

i met it ,and i solved it.
i think your script's named "docker-machine-prompt.bash" ,it's absolutely wrong .just rename it to the other with x premission.
the documents confused me indeed

@alexlukic
Copy link

alexlukic commented Mar 18, 2020

If you have the error __docker_machine_ps1: command not found, it means you need to tell your setup where it can find the file docker-machine-prompt.bash that you previously downloaded. For example in .bashrc, before the PS1 lines:

source /etc/bash_completion.d/docker-machine-prompt.bash

Thanks it works!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests