ryansch / docker-unifi-rpi

Unifi Controller for Raspberry Pi 3+ and x86
https://hub.docker.com/r/ryansch/unifi-rpi/
347 stars 42 forks source link

re-adopting after every docker restart? #28

Closed RezzZ closed 6 years ago

RezzZ commented 6 years ago

Hi, just installed your docker on my pi3b+ but I keep having some problems. Every time my pi/docker container restarts (for development reasons) I need to re-adopt all my devices before I can control them. They stay on adopting otherwise after a restart of the container. I need to ssh into my devices to inform them of my new docker controller. It seems some important settings are not persisted. Any thoughts?

I use a minor adjusted version from your compose file:

version: '2'
services:
  unifi:
    container_name: unifi
    image: ryansch/unifi-rpi:latest
    ports:
      - '3478:3478/udp'
      - '10001:10001/udp'
      - '6789:6789/tcp'
      - '8080:8080/tcp'
      - '8880:8880/tcp'
      - '8443:8443/tcp'
      - '8843:8843/tcp'
    volumes:
      - /opt/unifi/varlib:/var/lib/unifi
      - /opt/unifi/logs1:/usr/lib/unifi/logs
      - /opt/unifi/logs2:/var/log/unifi
      - /opt/unifi/run1:/usr/lib/unifi/run
      - /opt/unifi/run2:/run/unifi
      - /opt/unifi/work:/usr/lib/unifi/work
    restart: on-failure
    environment:
      - TZ=Europe/Amsterdam
ryansch commented 6 years ago

I see you're using bind mounting instead of docker volumes there. Can you verify that those directories exist in /opt/unifi on your pi? Also check the docker logs to make sure it's not having trouble writing to them.

ryansch commented 6 years ago

@RezzZ Actually I think the problem here is that you're trying to use the bridge network. The controller expects to be in the same broadcast domain as the managed devices unless you use layer 3 adoption. If you don't want to use host networking, I'd recommend you have a look at macvlan. https://docs.docker.com/network/macvlan/

RezzZ commented 6 years ago

thanks, putting the container in host mode seems to have fixed my problem.