问题描述
我在Mac中安装了Docker桌面.因此,为了启动docker,我打开应用程序并找到docker.然后,我可以在顶部栏中看到一个docker图标.稍后我可以从命令行运行docker命令.
我的问题是如何从命令行启动Docker本身?
Google搜索使我了解如何从命令行启动容器的结果:|
在macOS
上,您将使用launchctl
:
虽然实际上与Linux
上的service
或systemctl
等效于macOS
上的launchctl
(例如,使用launchd
运行docker Registry),但您实际上打算运行哪个服务尚不清楚:/p>
将Docker注册表plist复制到位:
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
启动Docker注册表:
launchctl load ~/Library/LaunchAgents/com.docker.registry.plist
重新启动Docker注册表服务
launchctl stop com.docker.registry
launchctl start com.docker.registry
卸载Docker注册表服务
launchctl unload ~/Library/LaunchAgents/com.docker.registry.plist
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 :|
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
这篇关于如何在Mac中从命令行启动Docker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!