For a project, we would like to specify some docker run flags with which the balena containers are started. Is it possible to do this in any way? More specifically, we would like to set the -d flag to run the container as daemon.
What is your reason for wanting to do this? The -d flag in docker run is shorthand for detached, which just means that the CLI will print the container ID and then return.
As Cameron mentioned, the -d flag makes sense in the CLI context only - it’s what allows to detach your terminal from the started container.
If you push a release to a device with balena system, container is managed by supervisor, and you don’t use the CLI unless you develop in local mode and ssh to the device to do some experiments, starting containers manually.
Have you tried running our examples (without modifications) with systemd linked in the docs?
Okay, that is clear. But it could still be desirable to be able to set the docker run flags sometimes such as network settings, I imagine. Or can you set such properties in the docker-compose.yml?
I have incorporated your dockerfile in our own dockerfiles, using your resin.service file and the entry.sh without modification, without any luck.
@tresink
Yes, it’s possible to configure a lot of things with docker-compose file.
Specifically, in your case, it’s important to run this container with init system in the privileged mode.
Hi @roman-mazur,
I tried to use it out of the box, but I cant seem to start the container with your entry.sh directly. The container exits immediately after startup. Am I missing something haha?
@tresink I see that the changes you made to the project are mainly to add udev support, is that correct? I think there’s something wrong in the entry.sh then, most likely.
We have some pending PR for this, that might work for you:
Could you get the code from that PR (which is this udev branch), and add your base image changes (and leave the entry.sh as it is for the time being) and see if that works for you? In our testing it worked.
You also should not add
network_mode: host
devices:
- '/dev:/dev'
most likely, as the first doesn’t play well with udev as much as I know, and the second should be unnecessary.
Unfortunately, this did not change anything for us! I tried the adapted entry.sh and removed the network_mode: host. Although I don’t understand why this would not play well with udev. We need both the network privileges as well as the udev eventually.
Hey @tresink rereading the issues, sorry that we weren’t totally clear that it’s the bluetooth that is not healthy. We are trying to reproduce things here closer to yours.
Can you give a bit more information:
what UPBoard are you using (normal, UP^2, etc…?)
is the bluetooth built in or a dongle?
what version of balenaOS are you using?
is the code that you are using still the same as you linked on Google Drive (except for the entry.sh and docker-compose.yml changes you mentioned?
We are gathering hardware here to be able to reproduce, and in my initial attempts I run into different issues with bluetooth in that container than you did, hence the question of trying to solve the same issue.