# Service Crashing Docker, Cannot Start

**URL:** https://forums.suse.com/t/service-crashing-docker-cannot-start/3695
**Category:** RancherOS
**Created:** [August 14, 2016, 4:23am UTC](https://forums.suse.com/t/service-crashing-docker-cannot-start/3695 "2016-08-14T04:23:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jnovack](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/jnovack/32/1593_2.png) [@jnovack](https://forums.suse.com/u/jnovack)
#### Post date: [August 14, 2016, 4:23am UTC](https://forums.suse.com/t/service-crashing-docker-cannot-start/3695/1 "2016-08-14T04:23:35Z")

</div>

Day 1 Newbie here, go easy.

I know I’m Doing It Wrong™, because I don’t know the right way. Trying to get a grasp on The Right Way™ by playing around.

This service starts perfectly as a run command when I’m in the command-line after boot. So I tried to make it a service.yml file and start it on boot. Unfortunately, it crashes the docker daemon, console never starts, and I have to reimage it (on a Raspberry Pi).

If I use `ros service enable path/file` and then `ros service start name` nothing happens. I presume because something is bad.

I have created a service as follows (indentation is correct).

`[rancher@rancher ~]$ cat /var/lib/rancher/conf/autossh.yml autossh: image: jnovack/rancher-autossh restart: never net: "host" privileged: true volumes: - /mnt/id_rsa:/id_rsa environment: - SSH_HOSTUSER=username - SSH_HOSTNAME=hostname`

If you can give me some insight on what’s wrong here, and the better way to do it, I would appreciate any help.

---

<div class="post-metadata">

### Author: ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)
#### Post date: [August 26, 2016, 6:26pm UTC](https://forums.suse.com/t/service-crashing-docker-cannot-start/3695/2 "2016-08-26T18:26:09Z")

</div>

Just to confirm. this is using RancherOS and not Rancher? Just want to put it in the right category.

Can you add in 3 backticks in front and back of your yaml file so I could see the indentation?

Can you list your exact commands and also run a `sudo ros service list` after you enable it?

After enabling it, you just need to run `sudo ros service up -d <name>` to start the service.

---

<div class="post-metadata">

### Author: ![jnovack](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/jnovack/32/1593_2.png) [@jnovack](https://forums.suse.com/u/jnovack)
#### Post date: [August 30, 2016, 6:08pm UTC](https://forums.suse.com/t/service-crashing-docker-cannot-start/3695/3 "2016-08-30T18:08:32Z")

</div>

Denise,

Yes, RancherOS image that was created for the Raspberry Pi.

The problem was solved (worked-around?) by setting the following labels.

I didn’t really want it to start in the System-Docker, but it does work as expected now. Not sure it’s the right way, and it doesn’t solve any containers I want to start in the User-Docker automatically.

```auto
  labels:
    - io.rancher.os.after=network
    - io.rancher.os.scope=system

```

```auto
[rancher@rancher ~]$ sudo ros service list
disabled amazon-ecs-agent
disabled kernel-headers
disabled kernel-headers-system-docker
disabled open-vm-tools
enabled /var/lib/rancher/conf/autossh.yml

```

I changed the container name, nothing else interesting.

```auto
[rancher@rancher ~]$ sudo cat /var/lib/rancher/conf/autossh.yml
autossh:
  image: jnovack/rpi-autossh
  net: "host"
  privileged: true
  labels:
    - io.rancher.os.after=network
    - io.rancher.os.scope=system
  volumes:
    - /mnt/id_rsa:/id_rsa
  environment:
    - SSH_USER=username
    - SSH_HOST=hostname

```

To initially set it up, I followed the official docs. [http://docs.rancher.com/os/system-services/adding-system-services/](http://docs.rancher.com/os/system-services/adding-system-services/)

```auto
$ sudo ros service enable /var/lib/rancher/conf/autossh.yml
$ sudo reboot

```

And let it download my image.

I did not start it, because I wanted to ensure it started on reboot. Upon reboot, that’s when the user-docker would crash and halt all other processes; console was unavailable, and ssh was not available. It was only after I added the two labels (`system` and `network`) did it work.

When loading just the `system` label, it didn’t crash (partial success!) but it did start before `network`, and thus added that label AFTER I realized that the `system` label worked.

Ultimately, I would like for services to NOT be started under the `system` context.
