I want to run my application as a service which starts on boot and always restarts if it exists for any reason.
To do this I’m trying to create and run a systemd service. However, I get an error when I manually trying to run systemctl start /etc/systemd/system/my_service.service
saying Failed to start etc-systemd-system-ccon\x2dism\x2dcloud.service.mount: Unit etc-systemd-system-ccon\x2dism\x2dcloud.service.mount failed to load: No such file or directory.
The content of the my_service.service file is:
[Unit]
Description=Main Application Service
[Service]
EnvironmentFile=/etc/docker.env
Type=simple
ExecStart=/app/my-binary
Restart=always
[Install]
WantedBy=multi-user.target
My dockerfile:
FROM resin/armv7hf-debian
# Copy repository content recursively to the 'app' folder
COPY . /app
# Switch on systemd init system in container and add the ccon-ism-cloud service
ENV INITSYSTEM on
COPY my_service.service /etc/systemd/system/my_service.service
RUN systemctl enable /etc/systemd/system/my_service.service
CMD /bin/bash