我正在尝试使用 launchctl 启动 docker-machine。我已经使用 docker 工具箱安装了 docker-machine。这是我的 plist 文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.docker.machine.default</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string>
</dict>
<key>ProgramArguments</key>
<array>
<string>docker-machine</string>
<string>start</string>
<string>default</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
但是我收到这个错误,并且不确定如何解决它。
^[[Oct 1 11:08:00 lm com.apple.xpc.launchd[1] (com.docker.machine.default[4157]): Service could not initialize: 14D136: xpcproxy + 13421 [1402][E34BADE4-4125-3886-AA5B-08E47BD0E884]: 0x2
答案1
迟到总比不到好 :)
ProgramArguments
(此处:)中的第一个参数docker-machine
需要是可执行文件的绝对路径docker-machine
。对我来说,它应该如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.docker.machine.default</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string>
</dict>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/docker-machine</string>
<string>start</string>
<string>default</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
通过运行来确定您的which docker-machine
。