Service exited after 10 seconds

Hi,

I am new to balena and are currently developing a multiple service fleet. After quite some testing I encountered a behaviour I can not understand.

I start/build a service via balena push <fleet>. The the service correctly is deployed to my device (raspberry pi compute module 4). Then the service starts. But after approximately 10 seconds the service exits, restarts and so on …

I reduced my problem to this small example:

Directory setup

MyProject/
├── docker-compose.yml
├── testservice/
│ ├── Dockerfile
│ └── script.sh

Dockerfile
FROM ubuntu:20.04

COPY /test/script.sh script.sh

RUN chmod +x script.sh

CMD ["./script.sh"]
docker-compose.yml
version: "2.1"

services:
test:
    build:
      context: .
      dockerfile: ./test/Dockerfile
      # init: true
      # network_mode: host
      # restart: always
      # privileged: true

the commented tags are some of the options I already tried it with.

script.sh
#!/bin/bash

while true; do
    echo "Service running"
    sleep 1  
done

Here you see the output:

2024-04-25T14:44:55+00:00 Starting service 'test sha256:0ed692de9b4e312d9303e110186b0f075216c8708196d29ab1e34bb4c0841203'
2024-04-25T14:44:56+00:00 Started service 'test sha256:0ed692de9b4e312d9303e110186b0f075216c8708196d29ab1e34bb4c0841203'
2024-04-25T14:44:56+00:00  test  Service running
2024-04-25T14:44:56+00:00  test  Service running
2024-04-25T14:44:57+00:00 Killing service 'test sha256:0ed692de9b4e312d9303e110186b0f075216c8708196d29ab1e34bb4c0841203'
2024-04-25T14:44:57+00:00  test  Service running
2024-04-25T14:44:58+00:00  test  Service running
2024-04-25T14:44:59+00:00  test  Service running
2024-04-25T14:45:00+00:00  test  Service running
2024-04-25T14:45:01+00:00  test  Service running
2024-04-25T14:45:02+00:00  test  Service running
2024-04-25T14:45:03+00:00  test  Service running
2024-04-25T14:45:04+00:00  test  Service running
2024-04-25T14:45:05+00:00  test  Service running
2024-04-25T14:45:06+00:00  test  Service running
2024-04-25T14:45:07+00:00  test  Service running
2024-04-25T14:45:08+00:00 Service exited 'test sha256:0ed692de9b4e312d9303e110186b0f075216c8708196d29ab1e34bb4c0841203'
2024-04-25T14:45:08+00:00 Killed service 'test sha256:0ed692de9b4e312d9303e110186b0f075216c8708196d29ab1e34bb4c0841203'
2024-04-25T14:45:08+00:00 Installing service 'test sha256:0ed692de9b4e312d9303e110186b0f075216c8708196d29ab1e34bb4c0841203'
2024-04-25T14:45:08+00:00 Installed service 'test sha256:0ed692de9b4e312d9303e110186b0f075216c8708196d29ab1e34bb4c0841203'
2024-04-25T14:45:08+00:00 Starting service 'test sha256:0ed692de9b4e312d9303e110186b0f075216c8708196d29ab1e34bb4c0841203'
2024-04-25T14:45:09+00:00 Started service 'test sha256:0ed692de9b4e312d9303e110186b0f075216c8708196d29ab1e34bb4c0841203'
2024-04-25T14:45:09+00:00  test  Service running
2024-04-25T14:45:09+00:00  test  Service running
2024-04-25T14:45:10+00:00 Killing service 'test sha256:0ed692de9b4e312d9303e110186b0f075216c8708196d29ab1e34bb4c0841203'
2024-04-25T14:45:10+00:00  test  Service running

It goes on like this forever.

I have BalenaOS dev installed and installed it via the balena etcher. I develop on WSL on a Debian system.

I already tried the “usual” things that I could think of: reboot, delete devices, create new fleet, update, …

Any help would be highly welcome.

Thanks in advance
Thomas

Hello @tbone could you please share more details on the balenaOS and supervisor versions?

What type of Raspberry Pi CM4 device are you using?

Thanks!