gcgarner / IOTstack

docker stack for getting started on IOT on the Raspberry PI
GNU General Public License v3.0
1.5k stars 578 forks source link

doesn't start after reboot #178

Closed realjanek closed 4 years ago

realjanek commented 4 years ago

root@raspberrypi:~# cd IOTstack root@raspberrypi:~/IOTstack# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES root@raspberrypi:~/IOTstack# docker-compose pull Pulling portainer ... done Pulling nodered ... done Pulling influxdb ... done Pulling grafana ... done root@raspberrypi:~/IOTstack# docker-compose up Starting influxdb ... Starting grafana ... Starting nodered ... Starting portainer ...

... and it stays here forever, not responding. What is the proper way of shutting down the power and restarting RPi and containers?

Paraphraser commented 4 years ago

First point, my understanding is that the "-d" option is needed on the "docker-compose up -d" command. It detaches the containers and runs them in the background.

Second point, whether it is "the proper way" or not I can't say but this is what I do. If I want to update my containers, I choose one of the following.

Option 1 - update all containers except Node-Red:

$ cd ~/IOTstack
$ docker-compose pull
$ docker-compose up -d

Option 2 - update all containers including Node-Red:

$ cd ~/IOTstack
$ docker-compose down
$ docker rmi "iotstack_nodered" "nodered/node-red"
$ docker-compose pull
$ docker-compose up --build -d

I install SQLite as part of Node-Red. That takes a very long time to build and spits out a huge number of compiler warnings, so Option 2 is not something I do all that often.

If I have reason to believe that the IOTstack project on Github has been updated then I do this:

$ cd ~/IOTstack
$ docker-compose down
$ git pull origin master
$ ./menu.sh
$ docker-compose up -d

If I were to strike a problem like you describe, this is what I would try:

  1. Reboot.

  2. Run "docker ps" and if it shows anything other than headings, take the running containers down via:

    $ cd ~/IOTstack
    $ docker-compose down
  3. List all of your images via:

    $ docker images
  4. Remove each image in turn using its "IMAGE ID". For example:

    $ docker rmi 0c9df6f99685

    Keep going until there are no images left. If rmi doesn't want to remove an image because it's a dependency for another image, remove that other image first.

  5. If you have any reason to think your docker-compose.yml file might be compromised, consider deleting it and rebuilding it from scratch by re-running the menu.

  6. Bring the stack up with:

    $ cd ~/IOTstack
    $ docker-compose up -d
realjanek commented 4 years ago

@Paraphraser @gcgarner Thanks a lot for answering. Much appreciate your help. I did follow your advice in the last section and it went almost ok, except for one:

... Pulling grafana (grafana/grafana:6.3.6)... 6.3.6: Pulling from grafana/grafana 245dbad35e84: Pull complete bc1d94e06384: Pull complete 1578a1c7d8ec: Pull complete d5d560aa8fbb: Pull complete 525bba436572: Pull complete b5d3581c6846: Pull complete 11664e74e734: Pull complete 2b25cb5ab71f: Pull complete 70952cf6efd0: Pull complete Digest: sha256:218ba67bfac261a71abde7cb306727edaa7d9a595bd70ceb5a644ea3dfb21229 Status: Downloaded newer image for grafana/grafana:6.3.6 Creating grafana ... error Creating nodered ... Creating influxdb ...

ERROR: for grafana Cannot start service grafana: b'driver failed programming ex ternal connectivity on endpoint grafana (796df18c6b4939a34d9bf6dbc21365d4eab3773 Creating nodered ... error ted'

ERROR: for nodered Cannot start service nodered: b'driver failed programming ex ternal connectivity on endpoint nodered (50c8847756755a74420d706234c69dd4b635cc5 a486302ee4db06163ebc8bb0f): Bind for 0.0.0.0:1880 failed: port is already alloca Creating influxdb ... error

ERROR: for influxdb Cannot start service influxdb: b'driver failed programming external connectivity on endpoint influxdb (e6d77e8c522ecd45872bac20bf44637171de 405faddd821f2f6b7c5f6477e1e4): Bind for 0.0.0.0:8086 failed: port is already all ocated'

ERROR: for grafana Cannot start service grafana: b'driver failed programming ex ternal connectivity on endpoint grafana (796df18c6b4939a34d9bf6dbc21365d4eab3773 2e4979e7b21ef0b3250dcd050): Bind for 0.0.0.0:3000 failed: port is already alloca ted'

ERROR: for nodered Cannot start service nodered: b'driver failed programming ex ternal connectivity on endpoint nodered (50c8847756755a74420d706234c69dd4b635cc5 a486302ee4db06163ebc8bb0f): Bind for 0.0.0.0:1880 failed: port is already alloca ted'

ERROR: for influxdb Cannot start service influxdb: b'driver failed programming external connectivity on endpoint influxdb (e6d77e8c522ecd45872bac20bf44637171de 405faddd821f2f6b7c5f6477e1e4): Bind for 0.0.0.0:8086 failed: port is already all ocated' ERROR: Encountered errors while bringing up the project. root@raspberrypi:~/IOTstack#

realjanek commented 4 years ago

@Paraphraser @gcgarner ... problem solved. I started to create new RPi image from scratch and firstly installed IOTstack. Everything works smoothly now. Thanks for your support. BTW, is it possible to run docker on RPi Zero W? At the moment I run it on RPi 3A+

Paraphraser commented 4 years ago

Someone else will have to answer that. I have only tried RPi 3B+ and 4B. Worked OK on both.

Also, Andreas Spiess bangs on about how only certain SSDs work with the RPi4 but I have never given that issue a moment’s thought. Every USB3 SSD I have tried “just works.” I don’t know whether that means I’ve been very lucky or Andreas has been a bit unlucky. Plus, I use the build approach here which doesn’t depend on either poking disk parameters or BerryBoot. I see the former as risky and the latter as overkill. That some people have reported problems getting IOTstack to coexist with BerryBoot doesn’t really surprise me. I reckon you can only ever have one level of complexity before you run into hassles and, for IOTstack, Docker is essential while BerryBoot is optional.