noble
noble copied to clipboard
Using noble within a docker container
I am trying to use noble in a node (v13.8.0) app running in a local docker container.
When I run my application I receive the below error. It seems like there is an issue with hci-socket.
`/app/node_modules/@abandonware/noble/lib/hci-socket/hci.js:75 this._socket = new BluetoothHciSocket(); ^
Error: EAFNOSUPPORT, Address family not supported by protocol
at new Hci (/app/node_modules/@abandonware/noble/lib/hci-socket/hci.js:75:18)
at new NobleBindings (/app/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:28:15)
at Object.
I found this on noble https://github.com/noble/noble/issues/805
Does anyone have a workaround?
Thanks!
I suspect problem in docker run params ? Maybe we can add a docker-compose file
Thanks, these are the docker commands I'm using:
docker build -t mqtt-server . docker run -it -p 9002:3002 -v $(pwd):/app mqtt-server /bin/bash
My Dockerfile:
`FROM node:latest
WORKDIR specifies the directory our WORKDIR /app RUN npm install -g nodemon COPY package.json /app/package.json RUN npm install && npm ls RUN mv /app/node_modules /node_modules COPY . /app ` Package.json:
` { "name": "TIG-docker", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "@abandonware/noble": "^1.9.2-5", "mqtt": "^3.0.0" } }
`
Is the problem in mqtt or noble module ?
Maybe try to play along different network mode, I used:
https://github.com/rzr/webthing-iotjs/blob/master/docker-compose.yml#L21
Thanks @rzr , Having done some more research, I think it's the bluetooth module in noble because I'm running docker locally on a mac but haven't found a solution so far?
https://forums.docker.com/t/cannot-access-macbook-built-in-bluetooth-in-docker-debian-container/32819 Maybe it's not to do with noble
Sorry I am a linux user but I can give a try, may you open a PR with docker-compose file running a sample self test and I'll try it and will share you logs
Hello! As AcCalzone mentioned, I am running into the same phenomenon here https://github.com/AlCalzone/ioBroker.ble/issues/422#issue-677958385
I have closed it, as it does not seem to be an AlCalzone/BLE issue then.
Any update on this here?
Maybe this issue can be solved as I solved mine:
Run the container with --net host rather than shared.
Although this thread is pretty old, it may help others to find the own mistake as I did after several days? https://github.com/buanet/docker-iobroker/issues/134#issuecomment-676683897
feel free to add a chapter in readme file about using with docker
Hi, did you run noble within a Docker container? Can you share your Dockerfile, I'm not sure of required dependencies and commands to run.
I have developed my own npm package that depends on @abandonware/noble
I am having a similar issue. Here is the error:
[node-red-contrib-ble-sense/protocols] Error: EAFNOSUPPORT, Address family not supported by protocol
I am running Node-RED on RPi 4 that runs DietPi.
Я разработал свой собственный пакет npm, который зависит от
@abandonware/noble
У меня похожая проблема. Вот ошибка:
[node-red-contrib-ble-sense/protocols] Error: EAFNOSUPPORT, Address family not supported by protocol
Я запускаю Node-RED на RPi 4, на котором работает DietPi.
Use --net=host
for docker cli, to resolve this problem (EAFNOSUPPORT)
This is indeed now written up in the README > Docker section: https://github.com/abandonware/noble/#docker
Thanks to @atrovato :heart: