Update README.md

Docker readme update to accommodate dongle auto discovery withing wmbusmeters
pull/180/head
BIBO 2020-11-03 19:32:13 +02:00 zatwierdzone przez GitHub
rodzic a33a9fb129
commit 063fb05516
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 42 dodań i 15 usunięć

Wyświetl plik

@ -12,7 +12,48 @@ MQTT, curled to a REST api, inserted into a database or stored in a log file.
- Linux x86-64 (`amd64`)
## Running the wmbusmeters container
### Prerequisite
wmbusmeters is able to detect attachment and removal of wmbus dongles and to provide that functionality within docker image it must be started in privileged mode to have access to hosts `/dev/` content
```
docker run -d --privileged \
--name=wmbusmeters \
--restart=always \
-v /etc/localtime:/etc/localtime:ro \
-v /opt/wmbusmeters:/wmbusmeters_data \
-v /dev/:/dev/ \
weetmuts/wmbusmeters
```
### Command line Options
| Parameter | Description |
| ------------ | ------------- |
| --privileged | Give extended privileges to this container to be able to read `/dev/` content |
| --name=wmbusmeters | Names the container "wmbusmeters". |
| --restart=always | Start the container when Docker starts (i.e. on boot/reboot). |
| -v /etc/localtime:/etc/localtime:ro | Ensure the container has the correct local time. |
| -v /opt/wmbusmeters:/wmbusmeters_data | Bind mount /opt/wmbusmeters (or any other directory) into the container for persistent storage that will contain configuration and log files. |
| -v /dev/:/dev/ | This will work for both wmbus and RTLSDR dongles. If only RTLSDR is used then `-v /dev/bus/usb/:/dev/bus/usb/` can be used. |
If docker-compose.yml file is being used, then it is also possible to copy/paste the following into existing docker-compose.yml, modifying the options as required (by omitting the version and services lines as existing docker-compose.yml may already contain those).
```
version: "2"
services:
wmbusmeters:
image: weetmuts/wmbusmeters
container_name: wmbusmeters
restart: always
volumes:
- /opt/wmbusmeters:/wmbusmeters_data
- /etc/localtime:/etc/localtime:ro
- /dev/:/dev/
```
Then, `docker-compose pull` can be used to pull the latest weetmuts/wmbusmeters image, `docker-compose up -d` to start the wmbusmeters container service, and `docker-compose down` to stop the wmbusmeters service and delete the container. It must be noted that those commands will also pull, start, and stop any other services defined in docker-compose.yml.
## How to run docker in unprivileged mode
If security is of concern - it is also possible to run docker container without privileged mode with non-RTLSDR dongles. For RTLSDR symlink passing to docker image is not working due to the fact that rtl_ binaries are looking for a full usb bus path in the system to identify device.
Before running the command that creates the wmbusmeters docker container, udev rules must be added to create usb device symlink in order to have persistent link to device across host restarts and reconnects of usb device:
```
@ -44,7 +85,6 @@ docker run -d \
| -v /opt/wmbusmeters:/wmbusmeters_data | Bind mount /opt/wmbusmeters (or any other directory) into the container for persistent storage that will contain configuration and log files. |
| --device=/dev/im871a | Passes the device at /dev/im871a into the container for use by wmbusmeters (path to device may need to be changed). |
> Device must be specified in configuration file if wmbusmeters does not find device by changing `device=auto` to `device=/dev/im871a` for example.
If docker-compose.yml file is being used, then it is also possible to copy/paste the following into existing docker-compose.yml, modifying the options as required (by omitting the version and services lines as existing docker-compose.yml may already contain those).
```
@ -63,19 +103,6 @@ services:
```
Then, `docker-compose pull` can be used to pull the latest weetmuts/wmbusmeters image, `docker-compose up -d` to start the wmbusmeters container service, and `docker-compose down` to stop the wmbusmeters service and delete the container. It must be noted that those commands will also pull, start, and stop any other services defined in docker-compose.yml.
### Using RTLSDR dongles with container
For RTLSDR symlink passing to docker image is not working due to the fact that rtl_ binaries are looking for a full usb bus path in the system to identify device. When using RTLSDR following docker command should be used to start container and in wmbusmeters config file `device=auto` should be changed to `device=rtlwmbus`
```
docker run -d --privileged \
--name=wmbusmeters \
--restart=always \
-v /etc/localtime:/etc/localtime:ro \
-v /opt/wmbusmeters:/wmbusmeters_data \
-v /dev/bus/usb/:/dev/bus/usb/ \
weetmuts/wmbusmeters
```
### Issues / Contributing
Please raise any issues with this container at its [GitHub repo](https://github.com/weetmuts/wmbusmeters)