Skip to content

Commit cfbf88f

Browse files
authored
Merge pull request docker#5232 from thaJeztah/dev_completion
install bash-completion in dev container
2 parents 9bb1a62 + 3f3ecb9 commit cfbf88f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ mod-outdated: ## check outdated dependencies
8686
authors: ## generate AUTHORS file from git history
8787
scripts/docs/generate-authors.sh
8888

89+
.PHONY: completion
90+
completion: binary
91+
completion: /etc/bash_completion.d/docker
92+
completion: ## generate and install the completion scripts
93+
94+
.PHONY: /etc/bash_completion.d/docker
95+
/etc/bash_completion.d/docker: ## generate and install the bash-completion script
96+
mkdir -p /etc/bash_completion.d
97+
docker completion bash > /etc/bash_completion.d/docker
98+
8999
.PHONY: manpages
90100
manpages: ## generate man pages from go source and markdown
91101
scripts/docs/generate-man.sh

dockerfiles/Dockerfile.dev

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
3535
FROM golang AS dev
3636
RUN apk add --no-cache \
3737
bash \
38+
bash-completion \
3839
build-base \
3940
ca-certificates \
4041
coreutils \
@@ -44,7 +45,8 @@ RUN apk add --no-cache \
4445
nano
4546

4647
RUN echo -e "\nYou are now in a development container. Run '\e\033[1mmake help\e\033[0m' to learn about\navailable make targets.\n" > /etc/motd \
47-
&& echo -e "cat /etc/motd\nPS1=\"\e[0;32m\u@docker-cli-dev\\$ \e[0m\"" >> /root/.bashrc
48+
&& echo -e "cat /etc/motd\nPS1=\"\e[0;32m\u@docker-cli-dev\\$ \e[0m\"" >> /root/.bashrc \
49+
&& echo -e "source /etc/bash/bash_completion.sh" >> /root/.bashrc
4850
CMD bash
4951
ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
5052
ENV PATH=$PATH:/go/src/github.com/docker/cli/build

0 commit comments

Comments
 (0)