Update Dockerization authored by Daniel Kluge's avatar Daniel Kluge
...@@ -2,6 +2,16 @@ Dockerizing the project is challenging because of two things: ...@@ -2,6 +2,16 @@ Dockerizing the project is challenging because of two things:
1. the classpath setup done in [start_component.sh](/implementation/start_component.sh) 1. the classpath setup done in [start_component.sh](/implementation/start_component.sh)
2. the GPIO pins of the Raspberry Pi must be accessible from inside the container for the lights 2. the GPIO pins of the Raspberry Pi must be accessible from inside the container for the lights
## Prior consideration: Network
Docker and docker-compose make setting up a container stack really easy.
But there is a huge drawback: mDNS resolution won't work from inside a container.
But as components like lights register their address as `hostname.local` in the registry and server mDNS resolution is needed.
There are 3 ways to get around this problem:
1. Don't use Docker. It makes the setup easier but setting up a working network may take too much time for your use case.
2. Use a fixed network configuration. This would need to be set in the router *and must be changed in the code*, so components register with their IP.
3. Use [this tool](https://github.com/hardillb/dns-to-mdns) and run it on any of the Pis. It needs to run on port 53 as you can't set a port in the configuration for Docker. You have to start your containers with the `--dns <IP of mDNS resolver>` flag (or the entry in the `docker-compose.yml`. This is only necessary for containers of components that need to call functions on other components (like the server or the light controller).
## Dockerfile Walkthrough ## Dockerfile Walkthrough
The Dockerfile is used to build the container. The Dockerfile is used to build the container.
It holds instructions on which files to copy and commands to run. It holds instructions on which files to copy and commands to run.
... ...
......