Docker on raspberry pi

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.

Moderator: leecollings

Post Reply
thoth
Posts: 5
Joined: Sunday 02 October 2016 6:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Docker on raspberry pi

Post by thoth »

I've been using domoticz inside a docker container on a raspberry pi for a couple of months now. I thought I would mention here in case anyone else might find it useful. There's a repo here:
https://github.com/joshuacox/mkdomoticz

you can checkout the arm branch, and `make run`, it will prompt you for a port which it will forward to port 8080 of the container. It's also possible to build it all locally, first checkout the 'local-stretch' branch, then you'll need this repo too
https://github.com/joshuacox/local-nginx

and `make stretch` to build a local copy of debian from scratch using debootstrap

for a docker ready pi image, I prefer starting here:
https://github.com/luxas/kubernetes-on-arm

he has a script `sdcard/write.sh` which is useful, which will prepare an SD card with docker ready to go on either arch linux or hypriotOS

which is yet another project to watch:
http://blog.hypriot.com/

Cheers! and hope everyone is having as much fun with this stuff as I am!
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Docker on raspberry pi

Post by remb0 »

thanks! I use docker on my synology and it works great.
maybe something for the wiki, would you like to write that?
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Docker on raspberry pi

Post by simonrg »

Neat, I am ignorant about Docker, what are the advantages of running inside a Docker image? To my simple mind the SD card image is already self-contained and can be backed up.

What am I missing?

Thanks.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Docker on raspberry pi

Post by remb0 »

Hardware Independent. Easy to Move to other hardware.
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Docker on raspberry pi

Post by simonrg »

remb0 wrote:Hardware Independent. Easy to Move to other hardware.
Ok still not sure I understand why Docker helps with Domoticz for users.

Domoticz is rather hardware dependent isn't it - what's plugged into which USB / PiFace card etc..

I have now read a couple of introductions to Docker, from which my understanding is that Docker is more software than hardware independent, i.e. Domoticz would be running in an identical software environment because of the Docker image it is part of.

Using a standard SD card image gives Domoticz a standard software environment, so Docker doesn't give any advantage here does it?

I can see that as a Docker image would be a lot smaller than a full SD card image, so for Domoticz this could make complete Domoticz environment updates a lot easier to distribute than SD card images.

Have I got it now?
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
thoth
Posts: 5
Joined: Sunday 02 October 2016 6:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Docker on raspberry pi

Post by thoth »

Well the advantage in my case is that eventually I want to move most services into an orchestrated environment where containerized applications can move freely across hardware to evenly distribute load among many devices. While my makefile does not do that yet, it is certainly where I'm going with it eventually. Here is an example of one where I have taken it to kubernetes:

https://github.com/joshuacox/local-ngin ... efile#L167

In any case it is useful for learning docker and/or kubernetes without paying a fortune in AWS fees, and the hardware is really cheap and power efficient to boot.

http://kubernetes.io/

Another point is that the compilation process takes a fair amount of time, and seeing as how I'm on google fiber here, . So in terms of disaster recovery,I can use luxas write script to prep a new SD card, boot the pi, mount NFS, and pull down my 700mb image from docker hub faster than the pi can compile. The neat thing is whether I chose the archlinux or hypriotOS (debian), the debian based domoticz image runs without issue (abstraction of the app from the underlying OS).
thoth
Posts: 5
Joined: Sunday 02 October 2016 6:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Docker on raspberry pi

Post by thoth »

@remb0 I would be happy to write that for the wiki, where do you think it should go appropriately?

Another advantage I can think of is more integration with other projects. Because, much like myself, I'm sure others are already using their pi for other things. My position at this point is that all pi I run have docker installed, and all of my apps are dockerized so I merely have to copy these git repos around with the necessary info cached into files that are gitignored, and the relevant data directories and start up services. Or have them in NFS etc, and the OS on the sdcard becomes less relevant.
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Docker on raspberry pi

Post by simonrg »

thoth wrote:@remb0 I would be happy to write that for the wiki, where do you think it should go appropriately?

Another advantage I can think of is more integration with other projects. Because, much like myself, I'm sure others are already using their pi for other things. My position at this point is that all pi I run have docker installed, and all of my apps are dockerized so I merely have to copy these git repos around with the necessary info cached into files that are gitignored, and the relevant data directories and start up services. Or have them in NFS etc, and the OS on the sdcard becomes less relevant.
Phew, very neat / sensible.

A Wiki page would be very useful, I currently have a lot of Pis running on a few SD images, but I am not properly managing things.

My thought was to implement NFS / NIS across all the machines, so I just have one set of userids and can easily transfer information between machines.

Then look into Ethernet booting to allow me to keep images on a NAS box.

Adding Docker on top of that would be even more manageable then, I would have one standard Pi image served from NAS to each machine, onto which each machine get implements the appropriate Docker container.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
thoth
Posts: 5
Joined: Sunday 02 October 2016 6:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Docker on raspberry pi

Post by thoth »

I did not realize you could net boot the things as well.

https://www.raspberrypi.org/forums/view ... f=7&t=1444

that makes things very interesting.
thoth
Posts: 5
Joined: Sunday 02 October 2016 6:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Docker on raspberry pi

Post by thoth »

I added a wiki page here:
https://www.domoticz.com/wiki/Docker

and I welcome pull requests and issues here:
https://github.com/joshuacox/mkdomoticz
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest