# Running systemctl within dockerfile

**URL:** <https://forums.balena.io/t/running-systemctl-within-dockerfile/365>\
**Category:** Product support\
**Created:** [October 20, 2016, 9:51pm UTC](https://forums.balena.io/t/running-systemctl-within-dockerfile/365 "2016-10-20T21:51:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonkemper](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/simonkemper/32/128_2.png) [@simonkemper](https://forums.balena.io/u/simonkemper)\
**Post date:** [October 20, 2016, 9:51pm UTC](https://forums.balena.io/t/running-systemctl-within-dockerfile/365/1 "2016-10-20T21:51:18Z")

</div>

Hi,

I am trying to run an application that consists of two separate Python-Sub-Applications on an [resin.io](http://resin.io) enabled Raspberry Pi.

On a non [resin.io](http://resin.io) enabled Raspberry Pi I am using **systemctl** for this and create two different services which are started during boot up of the device.

So I am looking for a way to use **systemctl** within a [resin.io](http://resin.io) **Dockerfile**. Is this possible? Any sample of how such a **dockerfile** would look like is greatly appreciated!

Thanks,

Simon

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [October 20, 2016, 10:39pm UTC](https://forums.balena.io/t/running-systemctl-within-dockerfile/365/2 "2016-10-20T22:39:59Z")

</div>

Hi @simonkemper,

I’d guess you can copy the service files in your Dockerfile to the and then use `systemctl enable` on them? The relevant sections cut out of a Dockerfile would be these:

```auto
ENV INITSYSTEM on
COPY myservice.service /lib/systemd/system/
RUN systemctl enable myservice.service

```

See the code in this example project: [https://github.com/resin-io-playground/resin-bbgw-bluetooth](https://github.com/resin-io-playground/resin-bbgw-bluetooth)

Is this what you are looking for?

---

<div class="post-metadata">

**Author:** ![simonkemper](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/simonkemper/32/128_2.png) [@simonkemper](https://forums.balena.io/u/simonkemper)\
**Post date:** [October 21, 2016, 9:09am UTC](https://forums.balena.io/t/running-systemctl-within-dockerfile/365/3 "2016-10-21T09:09:25Z")

</div>

This is exactly what I was looking for. I’ll give it a try and get back with details!

Thanks!
