<p>I'm using kubectl from within a docker container running on a Mac. I've already successfully configured the bash completion for kubectl to work on the Mac, however, it doesn't work within the docker container. I always get <code>bash: _get_comp_words_by_ref: command not found</code>. </p>

<p>The docker image is based on <code>ubuntu:16.04</code> and kubectl is installed via the line (snippet from the dockerfile)</p>

<pre><code>curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl &amp;&amp; \
mv kubectl /usr/local/bin
</code></pre>

<p><code>echo $BASH_VERSION</code> gives me <code>4.3.48(1)-release</code>, and according to apt, the <code>bash-completion</code>package is installed. </p>

<p>I'm using iTerm2 as terminal.</p>

<p>Any idea why it doesn't work or how to get it to work?</p>

DonGiovanni
<p>Ok, I found it - I simply needed to do a <code>source /etc/bash_completion</code> before or after the <code>source &lt;(kubectl completion bash)</code>.</p>
