Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brew install --cask docker fails after having done brew install docker #16309

Open
3 tasks done
rikhuijzer opened this issue Dec 9, 2023 · 11 comments
Open
3 tasks done
Labels
bug Reproducible Homebrew/brew bug help wanted We want help addressing this

Comments

@rikhuijzer
Copy link

rikhuijzer commented Dec 9, 2023

brew doctor output

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Putting non-prefixed coreutils in your path can cause GMP builds to fail.

Verification

  • My "brew doctor output" above says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update twice and am still able to reproduce my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

HOMEBREW_VERSION: 4.1.24
ORIGIN: https://github.com/Homebrew/brew
HEAD: ab6a7ed5a122b6d4f9d441ef76c86032398ced5f
Last commit: 4 days ago
Core tap JSON: 09 Dec 16:23 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: nvim
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: dodeca-core 64-bit arm_blizzard_avalanche
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.1.2 => /usr/bin/curl
macOS: 14.1.2-arm64
CLT: 15.0.0.0.1.1694021235
Xcode: N/A
Rosetta 2: false

What were you trying to do (and why)?

I was trying to install Docker via brew in order to run Docker. With that I mean that I wanted to have Docker and the Docker engine.

What happened (include all command output)?

$ brew install --cask docker
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/bed4da7666c34f984e83c3009a4d59a1bc68fb05/Casks/d/docker.rb
Already downloaded: /Users/rik/Library/Caches/Homebrew/downloads/ca29cc57571796f0b169705d4b13c4336527c673e367a147ceb2a84cd188d346--docker.rb
==> Downloading https://desktop.docker.com/mac/main/arm64/130397/Docker.dmg
Already downloaded: /Users/rik/Library/Caches/Homebrew/downloads/3fdd94dfca3d2383bd05a81c21a9500993d3f3e676e9f6f0f6e2aeade5bc0579--Docker.dmg
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'
==> Linking Binary 'docker' to '/usr/local/bin/docker'
==> Linking Binary 'docker-compose' to '/usr/local/bin/docker-compose'
==> Linking Binary 'docker-credential-desktop' to '/usr/local/bin/docker-credential-desktop'
==> Linking Binary 'docker-credential-ecr-login' to '/usr/local/bin/docker-credential-ecr-login'
==> Linking Binary 'docker-credential-osxkeychain' to '/usr/local/bin/docker-credential-osxkeychain'
==> Linking Binary 'docker-index' to '/usr/local/bin/docker-index'
==> Linking Binary 'kubectl' to '/usr/local/bin/kubectl.docker'
==> Unlinking Binary '/usr/local/bin/kubectl.docker'
==> Unlinking Binary '/usr/local/bin/docker-index'
==> Unlinking Binary '/usr/local/bin/docker-credential-osxkeychain'
==> Unlinking Binary '/usr/local/bin/docker-credential-ecr-login'
==> Unlinking Binary '/usr/local/bin/docker-credential-desktop'
==> Unlinking Binary '/usr/local/bin/docker-compose'
==> Unlinking Binary '/usr/local/bin/docker'
==> Backing App 'Docker.app' up to '/opt/homebrew/Caskroom/docker/4.26.0,130397/Docker.app'
==> Removing App '/Applications/Docker.app'
==> Purging files for version 4.26.0,130397 of Cask docker
Error: It seems there is already a Binary at '/opt/homebrew/etc/bash_completion.d/docker'.

What did you expect to happen?

Successful installation of the Docker cask.

Step-by-step reproduction instructions (by running brew commands)

$ brew install docker

$ docker run hello-world

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.

$ # Oops. Should have used cask.

$ brew install --cask docker
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/bed4da7666c34f984e83c3009a4d59a1bc68fb05/Casks/d/docker.rb
############################################################################################################################################################################################################## 100.0%
==> Downloading https://desktop.docker.com/mac/main/arm64/130397/Docker.dmg
############################################################################################################################################################################################################## 100.0%
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'
==> Linking Binary 'docker' to '/usr/local/bin/docker'
Password:
==> Linking Binary 'docker-compose' to '/usr/local/bin/docker-compose'
==> Linking Binary 'docker-credential-desktop' to '/usr/local/bin/docker-credential-desktop'
==> Linking Binary 'docker-credential-ecr-login' to '/usr/local/bin/docker-credential-ecr-login'
==> Linking Binary 'docker-credential-osxkeychain' to '/usr/local/bin/docker-credential-osxkeychain'
==> Linking Binary 'docker-index' to '/usr/local/bin/docker-index'
==> Linking Binary 'kubectl' to '/usr/local/bin/kubectl.docker'
==> Unlinking Binary '/usr/local/bin/kubectl.docker'
==> Unlinking Binary '/usr/local/bin/docker-index'
==> Unlinking Binary '/usr/local/bin/docker-credential-osxkeychain'
==> Unlinking Binary '/usr/local/bin/docker-credential-ecr-login'
==> Unlinking Binary '/usr/local/bin/docker-credential-desktop'
==> Unlinking Binary '/usr/local/bin/docker-compose'
==> Unlinking Binary '/usr/local/bin/docker'
==> Backing App 'Docker.app' up to '/opt/homebrew/Caskroom/docker/4.26.0,130397/Docker.app'
==> Removing App '/Applications/Docker.app'
==> Purging files for version 4.26.0,130397 of Cask docker
Error: It seems there is already a Binary at '/opt/homebrew/etc/bash_completion.d/docker'.

$ brew uninstall docker

Warning: Treating docker as a formula. For the cask, use homebrew/cask/docker

Uninstalling /opt/homebrew/Cellar/docker/24.0.7... (13 files, 31.8MB)

$ brew install --cask docker
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/bed4da7666c34f984e83c3009a4d59a1bc68fb05/Casks/d/docker.rb
Already downloaded: /Users/rik/Library/Caches/Homebrew/downloads/ca29cc57571796f0b169705d4b13c4336527c673e367a147ceb2a84cd188d346--docker.rb
==> Downloading https://desktop.docker.com/mac/main/arm64/130397/Docker.dmg
Already downloaded: /Users/rik/Library/Caches/Homebrew/downloads/3fdd94dfca3d2383bd05a81c21a9500993d3f3e676e9f6f0f6e2aeade5bc0579--Docker.dmg
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'
==> Linking Binary 'docker' to '/usr/local/bin/docker'
==> Linking Binary 'docker-compose' to '/usr/local/bin/docker-compose'
==> Linking Binary 'docker-credential-desktop' to '/usr/local/bin/docker-credential-desktop'
==> Linking Binary 'docker-credential-ecr-login' to '/usr/local/bin/docker-credential-ecr-login'
==> Linking Binary 'docker-credential-osxkeychain' to '/usr/local/bin/docker-credential-osxkeychain'
==> Linking Binary 'docker-index' to '/usr/local/bin/docker-index'
==> Linking Binary 'kubectl' to '/usr/local/bin/kubectl.docker'
==> Unlinking Binary '/usr/local/bin/kubectl.docker'
==> Unlinking Binary '/usr/local/bin/docker-index'
==> Unlinking Binary '/usr/local/bin/docker-credential-osxkeychain'
==> Unlinking Binary '/usr/local/bin/docker-credential-ecr-login'
==> Unlinking Binary '/usr/local/bin/docker-credential-desktop'
==> Unlinking Binary '/usr/local/bin/docker-compose'
==> Unlinking Binary '/usr/local/bin/docker'
==> Backing App 'Docker.app' up to '/opt/homebrew/Caskroom/docker/4.26.0,130397/Docker.app'
==> Removing App '/Applications/Docker.app'
==> Purging files for version 4.26.0,130397 of Cask docker
Error: It seems there is already a Binary at '/opt/homebrew/etc/bash_completion.d/docker'.

$ rm -rf /opt/homebrew/etc/bash_completion.d/docker

$ brew install --cask docker
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/bed4da7666c34f984e83c3009a4d59a1bc68fb05/Casks/d/docker.rb
Already downloaded: /Users/rik/Library/Caches/Homebrew/downloads/ca29cc57571796f0b169705d4b13c4336527c673e367a147ceb2a84cd188d346--docker.rb
==> Downloading https://desktop.docker.com/mac/main/arm64/130397/Docker.dmg
Already downloaded: /Users/rik/Library/Caches/Homebrew/downloads/3fdd94dfca3d2383bd05a81c21a9500993d3f3e676e9f6f0f6e2aeade5bc0579--Docker.dmg
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'
==> Linking Binary 'docker' to '/usr/local/bin/docker'
==> Linking Binary 'docker-compose' to '/usr/local/bin/docker-compose'
==> Linking Binary 'docker-credential-desktop' to '/usr/local/bin/docker-credential-desktop'
==> Linking Binary 'docker-credential-ecr-login' to '/usr/local/bin/docker-credential-ecr-login'
==> Linking Binary 'docker-credential-osxkeychain' to '/usr/local/bin/docker-credential-osxkeychain'
==> Linking Binary 'docker-index' to '/usr/local/bin/docker-index'
==> Linking Binary 'kubectl' to '/usr/local/bin/kubectl.docker'
==> Linking Binary 'docker.bash-completion' to '/opt/homebrew/etc/bash_completion.d/docker'
==> Unlinking Binary '/opt/homebrew/etc/bash_completion.d/docker'
==> Unlinking Binary '/usr/local/bin/kubectl.docker'
==> Unlinking Binary '/usr/local/bin/docker-index'
==> Unlinking Binary '/usr/local/bin/docker-credential-osxkeychain'
==> Unlinking Binary '/usr/local/bin/docker-credential-ecr-login'
==> Unlinking Binary '/usr/local/bin/docker-credential-desktop'
==> Unlinking Binary '/usr/local/bin/docker-compose'
==> Unlinking Binary '/usr/local/bin/docker'
==> Backing App 'Docker.app' up to '/opt/homebrew/Caskroom/docker/4.26.0,130397/Docker.app'
==> Removing App '/Applications/Docker.app'
==> Purging files for version 4.26.0,130397 of Cask docker
Error: It seems there is already a Binary at '/opt/homebrew/share/zsh/site-functions/_docker'.

$ rm -rf /opt/homebrew/share/zsh/site-functions/_docker

$ brew install --cask docker
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/bed4da7666c34f984e83c3009a4d59a1bc68fb05/Casks/d/docker.rb
Already downloaded: /Users/rik/Library/Caches/Homebrew/downloads/ca29cc57571796f0b169705d4b13c4336527c673e367a147ceb2a84cd188d346--docker.rb
==> Downloading https://desktop.docker.com/mac/main/arm64/130397/Docker.dmg
Already downloaded: /Users/rik/Library/Caches/Homebrew/downloads/3fdd94dfca3d2383bd05a81c21a9500993d3f3e676e9f6f0f6e2aeade5bc0579--Docker.dmg
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'
==> Linking Binary 'docker' to '/usr/local/bin/docker'
==> Linking Binary 'docker-compose' to '/usr/local/bin/docker-compose'
==> Linking Binary 'docker-credential-desktop' to '/usr/local/bin/docker-credential-desktop'
==> Linking Binary 'docker-credential-ecr-login' to '/usr/local/bin/docker-credential-ecr-login'
==> Linking Binary 'docker-credential-osxkeychain' to '/usr/local/bin/docker-credential-osxkeychain'
==> Linking Binary 'docker-index' to '/usr/local/bin/docker-index'
==> Linking Binary 'kubectl' to '/usr/local/bin/kubectl.docker'
==> Linking Binary 'docker.bash-completion' to '/opt/homebrew/etc/bash_completion.d/docker'
==> Linking Binary 'docker.zsh-completion' to '/opt/homebrew/share/zsh/site-functions/_docker'
==> Unlinking Binary '/opt/homebrew/share/zsh/site-functions/_docker'
==> Unlinking Binary '/opt/homebrew/etc/bash_completion.d/docker'
==> Unlinking Binary '/usr/local/bin/kubectl.docker'
==> Unlinking Binary '/usr/local/bin/docker-index'
==> Unlinking Binary '/usr/local/bin/docker-credential-osxkeychain'
==> Unlinking Binary '/usr/local/bin/docker-credential-ecr-login'
==> Unlinking Binary '/usr/local/bin/docker-credential-desktop'
==> Unlinking Binary '/usr/local/bin/docker-compose'
==> Unlinking Binary '/usr/local/bin/docker'
==> Backing App 'Docker.app' up to '/opt/homebrew/Caskroom/docker/4.26.0,130397/Docker.app'
==> Removing App '/Applications/Docker.app'
==> Purging files for version 4.26.0,130397 of Cask docker
Error: It seems there is already a Binary at '/opt/homebrew/share/fish/vendor_completions.d/docker.fish'.

$ rm -rf /opt/homebrew/share/fish/vendor_completions.d/docker.fish

$ brew install --cask docker
==> Downloading https://formulae.brew.sh/api/cask.jws.json
-=#=- #     #        #
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/bed4da7666c34f984e83c3009a4d59a1bc68fb05/Casks/d/docker.rb
Already downloaded: /Users/rik/Library/Caches/Homebrew/downloads/ca29cc57571796f0b169705d4b13c4336527c673e367a147ceb2a84cd188d346--docker.rb
==> Downloading https://desktop.docker.com/mac/main/arm64/130397/Docker.dmg
Already downloaded: /Users/rik/Library/Caches/Homebrew/downloads/3fdd94dfca3d2383bd05a81c21a9500993d3f3e676e9f6f0f6e2aeade5bc0579--Docker.dmg
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'
==> Linking Binary 'docker' to '/usr/local/bin/docker'
Password:
==> Linking Binary 'docker-compose' to '/usr/local/bin/docker-compose'
==> Linking Binary 'docker-credential-desktop' to '/usr/local/bin/docker-credential-desktop'
==> Linking Binary 'docker-credential-ecr-login' to '/usr/local/bin/docker-credential-ecr-login'
==> Linking Binary 'docker-credential-osxkeychain' to '/usr/local/bin/docker-credential-osxkeychain'
==> Linking Binary 'docker-index' to '/usr/local/bin/docker-index'
==> Linking Binary 'kubectl' to '/usr/local/bin/kubectl.docker'
==> Linking Binary 'docker.bash-completion' to '/opt/homebrew/etc/bash_completion.d/docker'
==> Linking Binary 'docker.zsh-completion' to '/opt/homebrew/share/zsh/site-functions/_docker'
==> Linking Binary 'docker.fish-completion' to '/opt/homebrew/share/fish/vendor_completions.d/docker.fish'
==> Linking Binary 'hub-tool' to '/usr/local/bin/hub-tool'
==> Linking Binary 'com.docker.cli' to '/usr/local/bin/com.docker.cli'
🍺  docker was successfully installed!
@rikhuijzer rikhuijzer added the bug Reproducible Homebrew/brew bug label Dec 9, 2023
@giladAlboher
Copy link

It seems like there were some lingering files from a previous installation of Docker that were causing conflicts during the reinstallation process. To resolve this issue, you successfully identified and removed these files.

@MikeMcQuaid MikeMcQuaid added the help wanted We want help addressing this label Dec 11, 2023
@MikeMcQuaid
Copy link
Member

This is a known issue that it's unclear how to be solved. There may already be a homebrew/cask issue for this CC @Homebrew/cask for help triaging.

Need to decide how best to handle this e.g. what symlinks to install/skip/etc.

@cho-m
Copy link
Member

cho-m commented Dec 19, 2023

docker Formula has a dependency on docker-completion Formula, both of which conflict with docker Cask.

The failures are coming from docker-completion, which won't be removed until brew autoremove or manually uninstalling.


Would say this is related to Homebrew/homebrew-cask#12822 as we do specify the conflict but it is only documentation (e.g. https://formulae.brew.sh/cask/docker#default) rather than providing a useful error when user tries following:

$ brew install docker
$ brew install --cask docker

@MikeMcQuaid
Copy link
Member

providing a useful error

not sure whether this conversation should be here or there but: I don't think this should be an error at all. Instead, either the formula or cask should not be linked and the user warned.

@cho-m
Copy link
Member

cho-m commented Dec 20, 2023

not sure whether this conversation should be here or there but: I don't think this should be an error at all. Instead, either the formula or cask should not be linked and the user warned.

Was basing this on how formulae are currently handled, e.g.

Error: Cannot install bash-completion because conflicting formulae are installed.
  bash-completion@2: because each are different versions of the same formula

Please `brew unlink bash-completion@2` before continuing.

Unlinking removes a formula's symlinks from /opt/homebrew. You can
link the formula again after the install finishes. You can --force this
install, but the build may fail or cause obscure side effects in the
resulting software.

EDIT: Though we may be handling the reverse situation for Cask-Formula conflict:

cask_installed_with_formula_name = begin
Cask::CaskLoader.load(formula.name).installed?
rescue Cask::CaskUnavailableError, Cask::CaskInvalidError
false
end
if cask_installed_with_formula_name
ohai "#{formula.name} cask is installed, skipping link."
return
end

@MikeMcQuaid
Copy link
Member

Though we may be handling the reverse situation for Cask-Formula conflict:

Yeh, we should do something similar to that, I think, but expand the definitions so that they don't need to have the same name.

Was basing this on how formulae are currently handled, e.g.

I think this makes sense for formulae that are often mutually exclusive. For formula/cask combos when it seems many people often want both: it kinda sucks.

@p-i-
Copy link

p-i- commented Apr 27, 2024

Please someone do something to prevent users from doing brew install docker and then eventually realizing they needed brew install --cask docker. Absolutely nobody wants the former. This will just trip up thousands of devs and waste their time, as it's a pretty reasonable thing to expect to work. (IIRC homebrew doesn't require the use of --cask any more).

@SMillerDev
Copy link
Member

Please someone do something to prevent users from doing brew install docker and then eventually realizing they needed brew install --cask docker. Absolutely nobody wants the former.

I want the former since I'm using a different container runtime and a lot of tools hardcode the docker command.

@carlocab
Copy link
Member

Please someone do something to prevent users from doing brew install docker and then eventually realizing they needed brew install --cask docker. Absolutely nobody wants the former.

I want the former since I'm using a different container runtime and a lot of tools hardcode the docker command.

Same here. The docker CLI is nice. I prefer using an open-source container runtime, however, and that's not what you get with the Docker cask.

@p-i-
Copy link

p-i- commented Apr 27, 2024

My bad.

But I suspect my main point still stands -- there's a sharp edge here that could maybe be smoothed over.

Usually brew install foo does the same as brew install --cask foo, right?

Is it possible for the Homebrew team to do something so that devs don't install the wrong thing by mistake and then have to dig out this issue to fix it?

Shouldn't the package be named docker-cli to make a clear disambiguation?

@MikeMcQuaid
Copy link
Member

Usually brew install foo does the same as brew install --cask foo, right?

No. It's usually brew install --formula if there's two with the same name.

Shouldn't the package be named docker-cli to make a clear disambiguation?

No. The cask could be renamed if we want to go down that route. docker-desktop or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/brew bug help wanted We want help addressing this
Projects
None yet
Development

No branches or pull requests

7 participants