Reputation: 11461
I have docker desktop installed in mac. So in order to start docker, I open applications and find docker. Then I can see a docker icon at the topbar. later I can run docker commands from the command line.
My question is how do I start the docker itself from command line?
Googling fetches me results on how to start a container from command line :|
Upvotes: 124
Views: 197869
Reputation: 1
in MacOs - easiest way is to install docker desktop and then starting this will solve the "is daemon running?" problem...
Upvotes: -6
Reputation: 31
On my Mac I started Docker Desktop via the Launchpad, and looked at the processes running with;
ps -ef | grep -i docker
I could see the app location to be;
/Applications/Docker 2.app
So I amended the above start up command slightly to;
open /Applications/Docker\ 2.app
And to kill all processes I first ran the following to see what the process name was;
pgrep -l Docker
38723 Docker Desktop
38731 Docker Desktop
38732 Docker Desktop
38735 Docker Desktop
38782 Docker Desktop
The passed this to killall;
killall 'Docker Desktop'
Upvotes: 2
Reputation: 39
start the docker desktop itself in macos :
open -a Docker
stop the docker desktop itself in macos :
killall Docker
Upvotes: 3
Reputation: 2307
You can open Docker Desktop on Mac using:-
open -a Docker
The Mac equivalent to systemctl
or service
is launchctl. But Docker Desktop is, presumably deliberately, packaged both on Mac and Windows as an application, not a service.
For shutdown, this:-
pkill -SIGHUP -f /Applications/Docker.app 'docker serve'
seems to work about as well as Quitting Docker from the GUI. By which I mean (a) when you restart Docker again it starts up with no complaints and (b) however I quit Docker Desktop, I still have a docker networking daemon left running.
Upvotes: 170
Reputation: 47169
On macOS
you'd use launchctl
:
It's unclear which service you are actually intending to run, although the equivalent to service
or systemctl
on Linux
is launchctl
on macOS
(eg. running docker registry with launchd
):
Copy the Docker registry plist into place:
plutil -lint registry/recipes/osx/com.docker.registry.plist
cp registry/recipes/osx/com.docker.registry.plist ~/Library/LaunchAgents/
chmod 644 ~/Library/LaunchAgents/com.docker.registry.plist
Start the Docker registry:
launchctl load ~/Library/LaunchAgents/com.docker.registry.plist
Restart the docker registry service
launchctl stop com.docker.registry
launchctl start com.docker.registry
Unload the docker registry service
launchctl unload ~/Library/LaunchAgents/com.docker.registry.plist
↳ Run the Docker Registry under launchd
Upvotes: 9