CoreOS单元发布失败
我尝试使用chat.service
上的chat.service
单元文件启动服务,但失败了:
// chat.service [Unit] Description=ChatApp [Service] ExecStartPre=-/usr/bin/docker kill simplechat1 ExecStartPre=-/usr/bin/docker rm simplechat1 ExecStartPre=-/usr/bin/docker pull jochasinga/socketio-chat ExecStart=/usr/bin/docker run -p 3000:3000 --name simplechat1 jochasinga/socketio-chat
fleetctl list-units
显示:
UNIT MACHINE ACTIVE SUB chat.service cfe13a03.../<virtual-ip> failed failed
但是,如果我将chat.service
更改为:
// chat.service [Service] ExecStart=/usr/bin/docker run -p 3000:3000 <mydockerhubuser>/socketio-chat
它运行得很好。 fleetctl list-units
显示:
UNIT MACHINE ACTIVE SUB chat.service 8df7b42d.../<virtual-ip> active running
编辑使用journalctl -u chat.service
我得到了:
Jun 02 00:02:47 core-01 systemd[1]: Started chat.service. Jun 02 00:02:47 core-01 systemd[1]: chat.service: Main process exited, code=exited, status=125/n/a Jun 02 00:02:47 core-01 docker[8924]: docker: Error response from daemon: failed to create endpoint clever_tesla on network brid Jun 02 00:02:47 core-01 systemd[1]: chat.service: Unit entered failed state. Jun 02 00:02:47 core-01 systemd[1]: chat.service: Failed with result 'exit-code'. Jun 02 00:02:58 core-01 systemd[1]: Stopped chat.service. Jun 02 00:03:08 core-01 systemd[1]: Stopped chat.service.
我在第一个chat.service
单元文件中做了什么错误? 任何指导表示赞赏。
在Mac OS X上运行CoreOS(稳定版)的Vagrant版本 。
您的ExecStartPre =命令似乎没有docker子命令。 你的意思是使用pull
?
阅读单位的日记应该让你更多的信息: journactl -u chat.service
在使用@Robbuild议和一些研究来查看日志之后,似乎docker无法在端口3000上创build端点,因为在OS上该端口上有一个正在运行的docker进程。
用docker stop <processname>
停止进程,然后用fleetctl start chat
重新fleetctl start chat
解决了这个问题。