"zsh: command not found: docker"
You're seeing the "zsh: command not found: docker" error because the docker command isn't recognized by your Zsh shell. This likely means that Docker's command-line interface (CLI) isn't installed, or its location isn't included in your shell's $PATH variable.
Here's how to fix this:
1. Check if Docker is Installed
First, you need to confirm if Docker Desktop for Mac is installed on your MacBook Pro. The Docker CLI tool is bundled with Docker Desktop, and you should install it via the official Docker website.
2. If Docker is not Installed
If Docker is not on your computer, you can download and install it from the official website. This will automatically install the necessary CLI tools and configure your $PATH.
Download: Go to the
.Docker website Install: Open the downloaded
.dmgfile and drag the Docker icon to your Applications folder.Run: Launch Docker Desktop from your Applications folder. You may need to log in to get it to run.
Verify: Open a new Terminal window and run
docker --version. This should confirm the installation.
3. If Docker is Installed but not in the Path
If you already have Docker Desktop installed, but you are still seeing this error, the path to the Docker CLI might not be correctly set up. Docker Desktop should handle this automatically on installation, but if it doesn't, you can add it to your .zshrc file:
Open your
.zshrcfile: In your terminal, runnano ~/.zshrcorvi ~/.zshrc.Add the path: Add the following line to the end of the file:
export PATH="/Applications/Docker.app/Contents/Resources/bin:$PATH"
Save and close:
For
nano, pressControl + X, thenY, thenEnter.For
vi, pressEscape, then type:wq, and pressEnter.
Reload the shell: To apply the changes, run
source ~/.zshrcor simply open a new terminal window.
4. Correcting the Original Command
Once you have verified Docker is properly installed and in your $PATH, you can then run the original command to add the Zsh completion script.
Correct command: The command you used was correct in its syntax, it just couldn't find the
dockercommand.Verify the path: Ensure the target directory for the completion script exists:
~/.oh-my-zsh/completions/Run again: After the previous steps, try the command again:
docker completion zsh > ~/.oh-my-zsh/completions/_docker
ความคิดเห็น
แสดงความคิดเห็น