unable to loop script, container doesn't exit.

hello everyone :wave:

I have a script setup or raspberrypi cam. the container itself just runs the script, which is a while-true loop taking pictures with raspiberrypi and then sleeping for 10 minutes, and then back to the loop.

this bit works fine.
what is not working is that even though the images should continue without end - it only takes about 40 images or so, for like 4/5 hours, and then stops.

worst case scenario - i’d like to container to restart (to restart for loop on reboot), but that doesn’t even happen -it just sits there.

any ideas as to what might be causing this, or what to look out for in journal/supervisor logs



so my dockerfile has entrypoint where I run a start.sh
while troubleshooting, I saw:

and they are using CMD instead of Entrypoint.

Whats the difference here? just to understand - if this balena-experiment repo Dockerfile used an ENTRYPOINT instead of CMD, what would the outcome be?


Hi, and welcome to the forums!

Regarding your first message, there could be several reasons why the app stops working. You can check the device logs by several means. If you like to use the terminal, you can go to your device homepage, open a HostOS terminal and run journalctl; this will show logs from all containers, os, supervisor and kernel. You can also see the container logs on the “Logs” section, but from your message it looks like the app is not logging anything.

Are you deploying the app using docker-compose? You could use the healthcheck property to have the engine auto-restart a non-responsive container


About the difference between CMD and ENTRYPOINT, if you’re not overriding them on your docker-compose or docker run command, there is no practical difference.

An explanation that I like is that the CMD is run from ENTRYPOINT, and the default ENTRYPOINT is /bin/sh -c

So if you want your image to run a command on a shell, you can just specify CMD. If you want to replace the shell and execute a process directly, you can use your own ENTRYPOINT

This is another good explanation:

  • CMD sets default command and/or parameters, which can be overwritten from command line when docker container runs.
  • ENTRYPOINT command and parameters will not be overwritten from command line. Instead, all command line arguments will be added after ENTRYPOINT parameters.


@puccaso just to complement my colleague’s message, did you try the cron block?

Let us know if this helps :slight_smile: