From 7df7a7c68f106fa0c08add5e387e5e709804afc1 Mon Sep 17 00:00:00 2001 From: Marcos Lilljedahl Date: Sat, 11 Mar 2017 15:56:57 -0300 Subject: [PATCH] Add docker cli bash completion Fixes #103 --- .bashrc => .profile | 0 Dockerfile.dind | 9 ++++++--- 2 files changed, 6 insertions(+), 3 deletions(-) rename .bashrc => .profile (100%) diff --git a/.bashrc b/.profile similarity index 100% rename from .bashrc rename to .profile diff --git a/Dockerfile.dind b/Dockerfile.dind index 098e45f..31254cd 100644 --- a/Dockerfile.dind +++ b/Dockerfile.dind @@ -1,6 +1,6 @@ FROM docker:17.03.0-ce-dind -RUN apk add --no-cache git tmux py2-pip apache2-utils vim build-base gettext-dev curl bash util-linux +RUN apk add --no-cache git tmux py2-pip apache2-utils vim build-base gettext-dev curl bash-completion bash util-linux ENV COMPOSE_VERSION=1.11.1 # Install Compose and Machine @@ -16,13 +16,16 @@ RUN mkdir -p /opt && cd /opt && \ ./configure && make install LDFLAGS=-lintl && \ rm -rf httping-2.5 +# Add bash completion +RUN mkdir /etc/bash_completion.d && curl https://raw.githubusercontent.com/docker/docker/master/contrib/completion/bash/docker -o /etc/bash_completion.d/docker + # Replace modprobe with a no-op to get rid of spurious warnings # (note: we can't just symlink to /bin/true because it might be busybox) RUN rm /sbin/modprobe && echo '#!/bin/true' >/sbin/modprobe && chmod +x /sbin/modprobe # Install a nice vimrc file and prompt (by soulshake) COPY ["docker-prompt","/usr/local/bin/"] -COPY [".vimrc",".bashrc", ".inputrc", ".gitconfig", "./root/"] +COPY [".vimrc",".profile", ".inputrc", ".gitconfig", "./root/"] COPY ["daemon.json", "/etc/docker/"] ARG docker_storage_driver=overlay2 @@ -39,5 +42,5 @@ CMD cat /etc/hosts >/etc/hosts.bak && \ sed -i "s/\PWD_IP_ADDRESS/$PWD_IP_ADDRESS/" /etc/docker/daemon.json && \ umount /var/lib/docker && \ dockerd &>/docker.log & \ - while true ; do script -q -c /bin/bash /dev/null ; done + while true ; do script -q -c "/bin/bash -l" /dev/null ; done # ... and then put a shell in the foreground, restarting it if it exits