Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 903
runnerpaul Avatar asked Sep 22 '20 11:09

runnerpaul


People also ask

How can I tell if Docker is running on Mac?

The operating-system independent way to check whether Docker is running is to ask Docker, using the docker info command. You can also use operating system utilities, such as sudo systemctl is-active docker or sudo status docker or sudo service docker status , or checking the service status using Windows utilities.

Where is Docker Daemon on Mac?

On MacOS go to the whale in the taskbar > Preferences > Daemon > Advanced, or locate ~/. docker/daemon. json. You can also start the Docker daemon manually and configure it using flags.

Can I run Docker locally on Mac?

Docker engine only runs on Linux. Docker Desktop - Since Docker Engine only runs on Linux, developers who use Windows and macOS for software development cannot run the engine until they spin up a virtual machine (VM) that runs linux.


1 Answers

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/

like image 194
Priyanka Avatar answered Oct 20 '22 21:10

Priyanka