Skip to content

Bash completion slows down bash login sessions #3889

@hoxu

Description

@hoxu
  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID:

Expected behavior

bash_completion.d/docker should be fast to execute. It probably should not make any docker calls until actually needed.

Actual behavior

Executing the bash completion script causes a noticeable pause when opening new bash sessions.

The slowest part is a call to docker:

+++ [[ -r /usr/local/etc/bash_completion.d/docker ]]
+++ . /usr/local/etc/bash_completion.d/docker
+++++ shopt -p extglob
++++ __docker_previous_extglob_setting='shopt -s extglob'
++++ shopt -s extglob
+++++ docker info --format '{{range .ClientInfo.Plugins}}{{if eq .Name "compose"}}{{.Path}}{{end}}{{end}}'

This seems to be:

COMPOSE_PLUGIN_PATH=$(docker info --format '{{range .ClientInfo.Plugins}}{{if eq .Name "compose"}}{{.Path}}{{end}}{{end}}')
$ time docker info --format '{{range .ClientInfo.Plugins}}{{if eq .Name "compose"}}{{.Path}}{{end}}{{end}}'
/usr/local/lib/docker/cli-plugins/docker-compose

real    0m2.538s
user    0m0.142s
sys     0m0.085s

Information

  • macOS Version:
  • Intel chip or Apple chip:
  • Docker Desktop Version: 4.14.1 (91661)

Output of /Applications/Docker.app/Contents/MacOS/com.docker.diagnose check

N/A

Steps to reproduce the behavior

Open a new bash login session.

To visually see what is taking up time:

bash -lx

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions