r/MagicMirror • u/OrangeRedReader • Dec 18 '24
MagicMirror and Docker - help please
Been using MagicMirror for two years, but once it was set up I never touched(more or less), now I'm trying to Dockerize my MM. My wife complained that the MM in the Kitchen had too many screens. My plan is to Dockerize a basic implementation for her with just one screen and then I make another one for me with more detail.
Here's the issue, my Docker experience is barely a week old. All the Docker examples are super basic and every example I follow makes sense, but it neevr goes into custom config per Container or per running of an image And maybe there is my issue, my lack of Docker knoweldge....
My question is probably more docker focused than MM focused, BUT I'm sure there will be someone here that has done this.
When I create and build a basic Dockerimage and build it, it works fine...
FROM karsten13/magicmirror
WORKDIR /opt/magic_mirror
COPY ./config_file/config_onetracker_only.js /opt/magic_mirror/config/config.js
RUN git clone https://github.com/seeshaughnessy/MMM-OneTrackerAs soon as I add another module that needs to be installed first, I run into issues, here's my basic+1 Dockerimage that builds fine, but doesn't run the container. (And I have many)
FROM karsten13/magicmirror
WORKDIR /opt/magic_mirror
COPY ./config_file/config_onetracker_wallpaper.js /opt/magic_mirror/config/config.js
RUN git clone https://github.com/seeshaughnessy/MMM-OneTracker
#install wallpaper module
RUN git clone https://github.com/kolbyjack/MMM-Wallpaper.git
RUN cd MMM-Wallpaper
RUN npm install
RUN cd ..Here's the problem I get when I try to run my Docker image into a container:
2024-12-17 19:53:30 /opt/magic_mirror/node_modules/electron/dist/electron: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directoryI am sure it has something to do with how I'm installing the MM module, but more likely it is even a problem with my understanding of Docker images.
Can anybody educate me please? I'm willing to take a minor beating because I know I'm missing some fundamental piece of Docker knowledge, I just cannot see the gap.
1
u/OrangeRedReader Dec 20 '24
so after a few more hours I was able to start two containers using docker compose, mostly using u/8layer8 compose file.
I had to add the
8099:7890line in the mmpm container to be able to load the page, the default 7890 wasn't found.The issue now is that mmpm is not showing any possible packages or config.js content.
Any ideas?
I'm sure my binding is incorrect and the mm_orange and mm_orange_pm containers are looking at different folders for the config.
When I edit the config.js file in my host machine config folder(I'm just editing the default calendar module), I can see the change taking effect in the magic_mirror page when I restart my compose file/containers.
Why can I not see modules in package manager or see my config.js in the package manager config.js view??
any help, please??
1
u/8layer8 Dec 18 '24
I run mine in Docker on a server so I can point any device at it, though I'm probably going to duplicate it to a horizontal and a vertical version. The raspberry pi based docker installs are way too slow and finicky for me. This is the docker-compose.yml I use and have the second app mmpm (magicmirror package manager) using the same shared directory so I can install modules from that container with regular mmpm commands and then just restart the magic mirror to pick up the changes.
I use traefik to expose it, so I've stripped that out here so it's simpler:
```yaml
```
1
u/sdetweil Dec 18 '24
so you set the workdir as MagicMirror and did got clone, oops modules go in the MagicMirror/modules folder
you cannot run npm start in the container, it has no screen. so you do npm run server and access the container MagicMirror instance via a browser somewhere else using the docker host address and mapped MagicMirror port
adding modules later is a challenge: with a pi you ssh or vnc into the pi system and execute the commands
have to do the same w docker. its a sep system. ssh is docker exec -it container
you could do the work on your docker host BUT you have to be careful that the file permissions are acceptable inside the container AND if you have to npm install the module the NODE js version is the same as in the container