'Docker command not found when running on Mac
I'm trying to run the below code as instructed in the docker-graphite-statsd:
docker run -d\
--name graphite\
--restart=always\
-p 80:80\
-p 2003-2004:2003-2004\
-p 2023-2024:2023-2024\
-p 8125:8125/udp\
-p 8126:8126\
graphiteapp/graphite-statsd
It gives this error:
$ sudo docker run -d --name graphite --restart=always -p 80:80 -p 2003-2004:2003-2004 -p 2023-2024:2023-2024 -p 8125:8125/udp -p 8126:8126 graphiteapp/graphite-statsd
sudo: docker: command not found
This is on a Mac. I tried brew install docker
but it made no difference.
How do I resolve this?
Solution 1:[1]
Run brew list which will show a list of all your installed Homebrew packages.
But it's highly recommended to install docker using below link on your mac :
Solution 2:[2]
After installing docker using Homebrew, start the Docker daemon by searching for Docker in the Application folder in Finder and running it.
I had to run the following from terminal after doing the above: docker run -d -p 80:80 docker/getting-started
Now run "docker --version" from terminal and it should give the desired result.
Reference : https://www.cprime.com/resources/blog/docker-on-mac-with-homebrew-a-step-by-step-tutorial/
Solution 3:[3]
Homebrew's docker doesn't install /usr/local/bin/docker or the /Applications/Docker.app any more on 10.13.
You have to download the Docker Desktop for Mac application from the docker.com site above and install it.
Solution 4:[4]
I'm afraid you need to add docker
command to your PATH manually. It can be done through profile file. As ZSH
is now a default shell on MacOS, it would go to ~/.zprofile
file:
# Add Visual Studio Code (code)
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
# Add Docker Desktop for Mac (docker)
export PATH="$PATH:/Applications/Docker.app/Contents/Resources/bin/"
Solution 5:[5]
If you successfully installed docker using the official package, the command should be available under /usr/local/bin/docker
.
That directory might not yet be in your $PATH, so you could try adding it, run:
export PATH="/usr/local/bin:$PATH"
this adds /usr/local/bin
to the front of your PATH
.
credit: https://stackoverflow.com/a/57231241/1601580
Detais:
Check docker is not there:
docker
zsh: command not found: docker
Check what PATH is:
echo $PATH
/Users/brandomiranda/.opam/__coq-platform.2022.01.0~8.15~beta1/bin:/Users/brandomiranda/opt/anaconda3/envs/meta_learning/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin
Then add PATH (To set it for current shell andĀ all processesĀ started from current shell use export
):
export PATH="/usr/local/bin:$PATH"
Check what I added to Path:
echo $PATH
/usr/local/bin:/Users/brandomiranda/.opam/__coq-platform.2022.01.0~8.15~beta1/bin:/Users/brandomiranda/opt/anaconda3/envs/meta_learning/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin
Seems that /usr/local/bin
wasn't in my path. Probably odd? Seems odd to me...why isn't it there?
Solution 6:[6]
This command helped me:
/Applications/Docker.app/Contents/Resources/bin/docker --version
Check version after that:
docker --version
Solution 7:[7]
You can also install docker
with following command on Mac:
brew install docker-machine docker
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | dataplumber |
Solution 2 | Priyanka |
Solution 3 | Michael Vilain |
Solution 4 | Nepomucen |
Solution 5 | Charlie Parker |
Solution 6 | Mark |
Solution 7 | Joy |