It's the same error as in several other posts, but none of the solutions work for me.

I'm typing

apt-get install ar<TAB><TAB>

and there's not auto-completion. I'm using an Ubuntu-Docker:

# Ubuntu Dockerfile
# https://github.com/dockerfile/ubuntu

# Pull base image.
FROM ubuntu:16.04

# Install.
  sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \
  apt-get update && \
  apt-get -y upgrade && \
  apt-get install -y build-essential && \
  apt-get install -y software-properties-common && \
  apt-get install -y byobu curl git htop man unzip vim wget  openssh-server  && \
  rm -rf /var/lib/apt/lists/*

RUN add-apt-repository main
RUN add-apt-repository universe
RUN add-apt-repository restricted
RUN add-apt-repository multiverse

RUN apt-get update

#ArangoDB stuff
RUN curl -OL https://download.arangodb.com/arangodb34/DEBIAN/Release.key && apt-key add - < Release.key
RUN echo 'deb https://download.arangodb.com/arangodb34/DEBIAN/ /' | tee /etc/apt/sources.list.d/arangodb.list
RUN apt-get install apt-transport-https 
RUN apt-get update

# Set environment variables.
ENV HOME /root

# Define working directory.

# Define default command.
CMD ["bash"]

which is working.

At first I couldn't use any auto-complete at all. Enabling the sections in the .bashrc allowed me to get the install, but now I'm stuck. What I did so far:

  • sudo apt-get update

From apt-get autocomplete package name is broken

sudo apt-get install bash-completion Enabled this in the /etc/bash.bashrc:

# enable bash completion in interactive shells
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion

In the .bashrc I enabled:

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion

Still, no changes. Is there something docker-specific I have to put into consideration?

Edit: Apparently it's a shell-issue. I installed zsh. In zsh it's working as supposed. I don't like to have this as a solution as I still don't understand why the regular shell refuses to work.

I have read about enabling auto completion for apt-get install in docker (ubuntu 14.04) - but frankly I don't quite get what the OP was doing to make it work.

  • Did you see this question? Looks like Docker does something specific to apt indeed! – Mr Shunz Apr 16 at 13:43
  • @MrShunz - I read that already but couldn't make much sense out of it – Qohelet Apr 17 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.