klein0r / fhem-docker

Just a template for a preconfigured fhem with mysql, mqtt and some other features in a docker environment
https://haus-automatisierung.com/
71 stars 55 forks source link

Habe eine Fehler bekommen beim Installieren von Nodered: Docker- Compose #9

Closed Jan-2005 closed 5 years ago

Jan-2005 commented 6 years ago

Nach langer suche habe ich das Problem endlich gefunden. Hinweiß für die anderen die das gleich Problem haben. Gruß Jan nodered: restart: always expose:

Habe es auf einem Ubuntu System laufen.

MalibuKoKo commented 6 years ago

@Jan-2005 : it's wrong (i think :) If you show logs for nodered's container with the command docker logs fhemdocker_nodered_1 --tail 40 --follow you can show a "permission denied" error :

npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.896050243' npm ERR! at Error (native) npm ERR! { Error: EACCES: permission denied, open 'npm-debug.log.896050243' npm ERR! at Error (native) npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'open', npm ERR! path: 'npm-debug.log.896050243' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

it's a common error when using docker, we don't pay attention to which user on the host run the container.

There are multiples solutions :

in your case the last solution is very easy, find your userId/groupId and set them in userdirective

For the userId :

id -u 1000

For the groupId :

id -g 1000

my user directive is user: "1000:1000"

Example :

version: '2'

services:
    mqtt:
        restart: always
        expose:
            - "1883"
            - "9001"
        ports:
            - "1883:1883"
            - "9001:9001"
        image: toke/mosquitto
        networks:
            - fhem-network
        volumes:
            - ./mqtt/config/:/mqtt/config/
            - ./mqtt/log/:/mqtt/log/
            - ./mqtt/data/:/mqtt/data/

    nodered:
        restart: always
        expose:
            - "1880"
        ports:
            - "1880:1880"
        image: nodered/node-red-docker:0.18.4
        volumes:
            - ./nodered/data/:/data/
        networks:
            - fhem-network
        depends_on:
            - "mqtt"
        user: "1000:1000"

networks:
    fhem-network:
        driver: bridge