Search code examples
dockervirtualizationcoreos

CoreOS Unit Failed on Launched


I tried launching a service using chat.service unit file on a CoreOS and it failed:

// 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 shows:

UNIT            MACHINE                     ACTIVE  SUB
chat.service    cfe13a03.../<virtual-ip>    failed  failed

However, if I changed the chat.service to just:

// chat.service
[Service]
ExecStart=/usr/bin/docker run -p 3000:3000 <mydockerhubuser>/socketio-chat

It ran just fine. fleetctl list-units shows:

UNIT            MACHINE                     ACTIVE  SUB
chat.service    8df7b42d.../<virtual-ip>    active  running

EDIT Using journalctl -u chat.service I got:

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.

What had I done wrong in the first chat.service unit file? Any guidance is appreciated.

Running Vagrant version of CoreOS (stable) on Mac OS X.


Solution

  • Your ExecStartPre= command doesn't seem to have a docker subcommand in it. Did you mean to use pull?

    Reading the journal for the unit should get you more information: journactl -u chat.service