DEV Community

Geoffrey Kim
Geoffrey Kim

Posted on

Resolving Docker Installation Conflicts on macOS

When attempting to install Docker on macOS using Homebrew, you might encounter several conflicts, especially if you've previously installed Docker using a different method. This post details how to resolve these conflicts and ensure a smooth installation process.

Background

Initially, Docker was installed using the regular Homebrew command:

brew install docker
Enter fullscreen mode Exit fullscreen mode

After deciding to switch to Docker Desktop for a more integrated experience, Docker was uninstalled:

brew uninstall docker
Enter fullscreen mode Exit fullscreen mode

Subsequently, the installation was attempted via Homebrew Cask:

brew install --cask docker
Enter fullscreen mode Exit fullscreen mode

This process led to multiple conflicts due to remnants of the previous Docker installations.

Step-by-Step Conflict Resolution

First Conflict: Bash Completion Script

The first error was caused by an existing bash completion script located at /usr/local/etc/bash_completion.d/docker.

Resolution:

To resolve this, the conflicting file was removed using:

sudo rm /usr/local/etc/bash_completion.d/docker
Enter fullscreen mode Exit fullscreen mode

After clearing the file, the Docker installation was retried.

Second Conflict: ZSH Completion Script

The installation process halted again due to a conflict with a zsh completion file at /usr/local/share/zsh/site-functions/_docker.

Resolution:

Similarly, the zsh completion file was removed:

sudo rm /usr/local/share/zsh/site-functions/_docker
Enter fullscreen mode Exit fullscreen mode

The Docker installation was attempted once more.

Third Conflict: Fish Completion Script

Another error occurred due to a Fish shell completion file located at /usr/local/share/fish/vendor_completions.d/docker.fish.

Resolution:

The conflicting Fish completion file was deleted:

sudo rm /usr/local/share/fish/vendor_completions.d/docker.fish
Enter fullscreen mode Exit fullscreen mode

This allowed the Docker installation to complete successfully.

Conclusion

After resolving these conflicts, Docker was successfully installed using Homebrew Cask. This process may seem daunting, but carefully managing and removing conflicting files can solve installation issues. If you face persistent problems, it might be necessary to conduct a more comprehensive cleanup of related files.

This experience underscores the importance of thoroughly removing all components related to previous installations before attempting a new installation, especially when switching installation methods.

Top comments (0)