Enabling Docker command-line plugins from Homebrew

Submitted by Darren Oh on

The docker-compose and docker-buildx formulae from Homebrew say to enable them by adding

"cliPluginsExtraDirs":
  [ "$HOMEBREW_PREFIX/lib/docker/cli-plugins"
]

to ~/.docker/config.json. You might reasonably assume that Docker replaces $HOMEBREW_PREFIX with the Homebrew installation path. You would be wrong. Docker will not find your plugins if you put $HOMEBREW_PREFIX/lib/docker/cli-plugins in ./docker/config.json. You have to replace $HOMEBREW_PREFIX with the Homebrew installation path yourself. For example, if Homebrew is installed in /opt/homebrew, the path has to be /opt/homebrew/lib/docker/cli-plugins, not $HOMEBREW_PREFIX/lib/docker/cli-plugins.