Hey @rapha, UDEV=1 is not outdated, see in the source code of the entry script here
The ENTRYPOINT indeed shouldn’t be rewritten, as it’s in that entry sript that we are setting up the dymanic plugging (for the dev file system and udev properly)
Yeah, that clarification is due indeed, will mark it as our docs improvement. The point being is that by default UDEV is no longer turned on (which is the same as setting it to off. On the other hand, either setting it to 1, true or on will turn it on, to keep with backwards compatibility.
Overwriting the ENTRYPOINT is always going to mess with base images (any kind of base images, in my experience) but I guess it’s worth clarifying on our side too not to do that. Thanks @rapha!
Just to clarify, what problem are you seeing. I note that in your docker-compose.yml file, the UDEV environment variable and the path to /dev isn’t indented correctly, which is probably causing problems with our Supervisor (or for it to ignore them). These need to be indented as such:
environment:
- UDEV=1
...
devices:
- '/dev:/dev'
With those set correctly, I believe your setup should work correctly.
Hey @nikunj, which base image are you using in the ./nodejs/Dockerfile? I’m asking as the UDEV=1 env var is specific to balenalib base images and is handled by the ENTRYPOINT so if you’re using another base image or overriding the ENTRYPOINT in your dockerfile then you will have to implement the equivalent behaviour yourself
@nikunj, you docker-compose.yml looks OK. I think the original poster in this thread had found that a key issue was that the Dockerfile for one of their services was overriding the ENTRYPOINT and bypassing the /usr/bin/entry.sh script. A sample entry.sh script is given at the following link – note in particular how it sets the UDEV=‘on’ variable in the app container (in addition to the UDEV=1 variable set in the docker-compose file):
If we overwrite /usr/bin/entry.sh then can we overwrite the requirements for the the udev and privileged flags being set in the docker-compose.yml?
@jason10, do you mean whether it would be possible to have it “working all the same” without setting privileged and UDEV in docker-compose.yml? (Provided you “do what’s needed” in your own overriden entry.sh script.) If that’s what you meant, then I think the answer is:
“No” for the priviledged flag, because I believe it is interpreted by balenaEngine regardless of the entry.sh script.
“Maybe” (i.e., I don’t really know) regarding the UDEV variable.
I’m not suggesting that this overwriting of /usr/bin/entry.sh is wise […]
Indeed, let me list a few reasons why I do not think it is wise to skip UDEV=1, even if you could:
Even if it worked now, future updates to balenalib images might break it, because you’d be relying in undocumented behaviour (or going against the documented behaviour…)
Every time in the future that you shared your docker-compose file with balena support or forums, the first thing that everyone would point out is that you’re missing UDEV=1 in your docker-compose…
Even your work colleagues in your company, or consultants or freelancers, would get confused because they’ll see it doesn’t match the documentation.
Still does not work. In the meantime I also tried the new version of GENERIC x86_64 (GPT) - but same thing: USB-hotplug-events are not recognized by any balena-docker-container services !
Only network_mode: host works - but this is of no use for me since I absolutely need my container-services in bridge-mode !!
Here are my settings in all my container services. But no success with it.
I tried about every node USB-detection library out there. All work locally (or as mentioned with network_mode = host). But as soon as I change to bridge-mode, they don’t work anymore!