Running systemctl within dockerfile


#1

Hi,

I am trying to run an application that consists of two separate Python-Sub-Applications on an resin.io enabled Raspberry Pi.

On a non 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 Dockerfile. Is this possible? Any sample of how such a dockerfile would look like is greatly appreciated!

Thanks,

Simon


#2

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:

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

Is this what you are looking for?


#3

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

Thanks!