315401 (10) [Avatar] Offline
#1
The code does work fine after removing " --name mynginx" from the unit file.

core@core-01 ~ $ fleetctl start nginx.service
Unit nginx.service inactive
Unit nginx.service launched on a5a49b9c.../172.17.8.101
core@core-01 ~ $ fleetctl list-units
UNIT            MACHINE                         ACTIVE  SUB
nginx.service   a5a49b9c.../172.17.8.101        failed  failed
core@core-01 ~ $ fleetctl status nginx
? nginx.service - My Nginx Server
   Loaded: loaded (/run/fleet/units/nginx.service; linked-runtime; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2016-12-03 06:30:58 UTC; 10s ago
  Process: 2566 ExecStart=/usr/bin/docker --name mynginx run -p 80:80 nginx:latest (code=exited, status=125)
  Process: 2561 ExecStartPre=/usr/bin/docker pull nginx:latest (code=exited, status=0/SUCCESS)
  Process: 2555 ExecStartPre=/usr/bin/docker rm nginx (code=exited, status=1/FAILURE)
  Process: 2546 ExecStartPre=/usr/bin/docker kill nginx (code=exited, status=1/FAILURE)
 Main PID: 2566 (code=exited, status=125)

Dec 03 06:30:56 core-01 docker[2555]: Error response from daemon: No such container: nginx
Dec 03 06:30:58 core-01 docker[2561]: latest: Pulling from library/nginx
Dec 03 06:30:58 core-01 docker[2561]: Digest: sha256:3861a20a81e4ba699859fe0724dc6afb2ce82d21cd1ddc27fff6ec76e4c2824e
Dec 03 06:30:58 core-01 docker[2561]: Status: Image is up to date for nginx:latest
Dec 03 06:30:58 core-01 systemd[1]: Started My Nginx Server.
Dec 03 06:30:58 core-01 docker[2566]: flag provided but not defined: --name
Dec 03 06:30:58 core-01 docker[2566]: See '/usr/bin/docker --help'.
Dec 03 06:30:58 core-01 systemd[1]: nginx.service: Main process exited, code=exited, status=125/n/a
Dec 03 06:30:58 core-01 systemd[1]: nginx.service: Unit entered failed state.
Dec 03 06:30:58 core-01 systemd[1]: nginx.service: Failed with result 'exit-code'.