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?
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/"
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?
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?
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?
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?
This command helped me:
/Applications/Docker.app/Contents/Resources/bin/docker --version
Check version after that:
docker --version
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.
You can also install docker
with following command on Mac :
brew install docker-machine docker
So to install images, instead of
/bin/docker run -d -p 80:80 docker/getting-started
use
/Applications/Docker.app/Contents/Resources/bin/docker run -d -p 80:80 docker/getting-started
There's is likely a better solution but this worked for me (macOS):
Edit your .zshrc
or .bashrc
, depending on which one you use
vi ~/.zshrc # or ~/.bashrc
In my case .zshrc
# ~/.zshrc
...
alias docker="/Applications/Docker.app/Contents/Resources/bin/docker"
...
source ~/.zshrc
this should work now
docker --version
This works because we're aliasing docker
to the executable located in /Applications/Docker.app/Contents/Resources/bin/docker
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.