Trouble starting rancher/agent with cloud-init

Launching EC2 instance.
RancherOS v0.4.1
Rancher Server v0.49.1

Has anyone been able to start a rancher/agent on ROS startup using cloud-config like this:

#cloud-config
rancher:
  services:
    rancher-agent:
      image: rancher/agent:latest
      command: http://<rancher-server-ip>:8080/v1/projects/1a5/scripts/<registrationToken>
      privileged: true
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock

following this example.

I can see the container start then it immediately gets terminated.

$ cat /var/log/docker.log
...
time="2015-12-10T16:24:10.723480703Z" level=info msg="GET /v1.15/containers/31e89e73e47d325c68cb2d7cb90b62732c0095f2f58d5a275b2f1bc630e9464b/json"
time="2015-12-10T16:24:10.724158609Z" level=info msg="GET /v1.15/containers/json?all=1&size=0&filters={\"label\":[\"io.docker.compose.name=os_rancher-agent_1\"]}"
time="2015-12-10T16:24:10.724637932Z" level=info msg="GET /v1.15/containers/31e89e73e47d325c68cb2d7cb90b62732c0095f2f58d5a275b2f1bc630e9464b/json"
time="2015-12-10T16:24:10.725636432Z" level=info msg="POST /v1.15/containers/31e89e73e47d325c68cb2d7cb90b62732c0095f2f58d5a275b2f1bc630e9464b/start"
time="2015-12-10T16:24:12.619091366Z" level=info msg="GET /v1.18/containers/31e89e73e47d/json"
time="2015-12-10T16:24:12.865521731Z" level=info msg="GET /v1.18/version"
time="2015-12-10T16:24:12.877474250Z" level=info msg="GET /v1.18/version"
time="2015-12-10T16:24:12.889332498Z" level=info msg="GET /v1.18/version"
time="2015-12-10T16:24:12.900754424Z" level=info msg="GET /v1.18/version"
time="2015-12-10T16:24:12.911748800Z" level=info msg="GET /v1.18/info"
time="2015-12-10T16:24:21.626280754Z" level=info msg="POST /v1.18/containers/create"
time="2015-12-10T16:24:21.668879169Z" level=info msg="POST /v1.18/containers/b4641c5a0186b17f9ae8399841024657cb9dc60ebf632120df4358ab70c0036f/attach?stderr=1&stdout=1&stream=1"
time="2015-12-10T16:24:21.669393000Z" level=info msg="POST /v1.18/containers/b4641c5a0186b17f9ae8399841024657cb9dc60ebf632120df4358ab70c0036f/start"
time="2015-12-10T16:24:21.835913343Z" level=info msg="POST /v1.18/containers/b4641c5a0186b17f9ae8399841024657cb9dc60ebf632120df4358ab70c0036f/wait"
time="2015-12-10T16:24:21.871517202Z" level=info msg="GET /v1.18/containers/b4641c5a0186b17f9ae8399841024657cb9dc60ebf632120df4358ab70c0036f/json"
time="2015-12-10T16:24:21.873201621Z" level=info msg="DELETE /v1.18/containers/b4641c5a0186b17f9ae8399841024657cb9dc60ebf632120df4358ab70c0036f?v=1"
time="2015-12-10T16:24:25.026905683Z" level=info msg="GET /v1.18/containers/rancher-agent/json"
time="2015-12-10T16:24:25.038748312Z" level=info msg="DELETE /v1.18/containers/rancher-agent?force=1"

You cannot label the service as rancher-agent and then it will work. Also, you should use the specific rancher/agent version that is pinned with the release. You can find it when you look at the “Add Custom Host” command.

So if you change it to

#cloud-config
rancher:
  services:
    rancher-agent1:
      image: rancher/agent:v0.8.2
      command: http://<rancher-server-ip>:8080/v1/projects/1a5/scripts/<registrationToken>
      privileged: true
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock

http://docs.rancher.com/rancher/faqs/troubleshooting/#adding-in-name-rancher-agent