Dockerfile is used to create Image
Image is not a runtime, is just a sillicon form for the containers
Balena builder that is building your image definitely doesn’t have your serial device
Run command is running during build, not deploy
After image is builded -> your fleet (device) is downloading this update, and creates containers from builded image, and now is the moment when the script should run
You should move any directive related to your device onto entrypoint script/program
COPY entrypoint.sh /entrypoint
ENTRYPOINT ["/bin/bash", "/entrypoint"]
Check the link
is an immutable (unchangeable) file that contains the source code, libraries, dependencies, tools, and other files needed for an application to run.
Due to their read-only quality, these images are sometimes referred to as snapshots. They represent an application and its virtual environment at a specific point in time. This consistency is one of the great features of Docker. It allows developers to test and experiment software in stable, uniform conditions.
Since images are, in a way, just templates , you cannot start or run them. What you can do is use that template as a base to build a container. A container is, ultimately, just a running image. Once you create a container, it adds a writable layer on top of the immutable image, meaning you can now modify it.