Closed bastilimbach closed 4 years ago
I think you can't use FROM node:12-stretch
in your Dockerfile for different architectures. With this line, it will pull the x86_64 image because the travis-runner has this architecture. So you have to use different images for every architecture, e.g. arm32v7/node:12-stretch
for arm (with qemu).
Was researching this as I'm also having the same issue (docker on raspberry pi 3) and came across a thread that mentioned it could be showing this error due to the windows style line (CRLF) endings on the entrypoint script. Any chance that's causing the issue here?
See https://nickjanetakis.com/blog/fixing-exec-format-errors-with-docker-entrypoint-scripts-on-windows
Mhh, maybe. We previously had some steps in the Dockerfile to transform the line endings but I removed it as I thought this was not necessary anymore. I’ll create a separate branch and test it. @jtuckr would you be able to test it as soon as I push a new version? I currently do not have a raspberry pi at hand.
Yes definitely.
Any chance that's causing the issue here?
no:
pi@raspberrypi:~ $ docker run --rm -it --entrypoint /bin/sh bastilimbach/docker-magicmirror:latest
standard_init_linux.go:211: exec user process caused "exec format error"
docker-entrypoint.sh
is not involved here ...
any news on this issue? I can test it right away on my RPi4
I think you can't use
FROM node:12-stretch
in your Dockerfile for different architectures. With this line, it will pull the x86_64 image because the travis-runner has this architecture. So you have to use different images for every architecture, e.g.arm32v7/node:12-stretch
for arm (with qemu).
I've rebuilt the Dockerfile and it works! I've used FROM arm32v7/node:12-stretch
and build image using docker build -t "arm-mmirror" .
That appears to have worked for me as well, but now having issues actually pulling up magic mirror where it is listening.
To summarize, here's what I did that got me this far:
git clone https://github.com/bastilimbach/docker-MagicMirror.git
cd docker-MagicMirror
FROM arm32v7/node:12-stretch
and saved the filedocker build -t arm-mmirror
command (I had to run it as sudo, but otherwise it worked fine after some time)docker run -d \ --publish 80:8181 \ --restart always \ --volume ~/magic_mirror/config:/opt/magic_mirror/config \ --volume ~/magic_mirror/modules:/opt/magic_mirror/modules \ --name magic_mirror \ arm-mmirror
(note: I have a copy of the "sample" config.js located under ~/magic_mirror/config but I modified the port line to 8181 from its default of 8080)docker logs magic_mirror
and this is what I see in the output:[05:26:18.582] [LOG] Starting MagicMirror: v2.10.0 [05:26:18.618] [LOG] Loading config ... [05:26:18.645] [LOG] Loading module helpers ... [05:26:18.653] [LOG] No helper found for module: alert. [05:26:18.819] [LOG] Initializing new module helper ... [05:26:18.821] [LOG] Module helper loaded: updatenotification [05:26:18.827] [LOG] No helper found for module: clock. [05:26:20.917] [LOG] Initializing new module helper ... [05:26:20.919] [LOG] Module helper loaded: calendar [05:26:20.922] [LOG] No helper found for module: compliments. [05:26:20.926] [LOG] No helper found for module: currentweather. [05:26:20.931] [LOG] No helper found for module: weatherforecast. [05:26:21.031] [LOG] Initializing new module helper ... [05:26:21.034] [LOG] Module helper loaded: newsfeed [05:26:21.035] [LOG] All module helpers loaded. [05:26:21.039] [LOG] Starting server on port 8181 ... [05:26:21.072] [LOG] Server started ... [05:26:21.076] [LOG] Connecting socket for: updatenotification [05:26:21.078] [LOG] Connecting socket for: calendar [05:26:21.079] [LOG] Starting node helper for: calendar [05:26:21.080] [LOG] Connecting socket for: newsfeed [05:26:21.082] [LOG] Starting module: newsfeed [05:26:21.082] [LOG] Sockets connected & modules started ... [05:26:21.084] [LOG] Ready to go! Please point your browser to: http://localhost:8181
So i'm a bit at a loss on that last bit. Is there a firewall setting or something that I need to change? Before, running magic mirror on this same pi using pm2 would work fine, but it wasn't using serveronly mode I understand, so this is a little different. Any help or guidance would be appreciated!
"localhost refused to connect". I'm having the same issue, commenting here to check later for any solutions
According to localhost refused to conection
I think there is an error in documentation. Use address: "0.0.0.0"
in your config.js file. Did you changed in Docerfile EXPOSE
line? If you are modyfing a docker port, I think you should change this line too. Here is my complete Dockerfile:
FROM arm32v7/node:12-stretch
RUN apt-get update
ENV NODE_ENV production
WORKDIR /opt/magic_mirror
RUN git clone --depth 1 -b master https://github.com/MichMich/MagicMirror.git .
RUN cp -R modules /opt/default_modules
RUN cp -R config /opt/default_config
RUN npm install --unsafe-perm --silent
COPY mm-docker-config.js docker-entrypoint.sh ./
RUN chmod +x ./docker-entrypoint.sh
EXPOSE 8889
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["node", "serveronly"]
And then config.js file:
var config = {
address: "0.0.0.0", // Address to listen on, can be:
// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
// - another specific IPv4/6 to listen on a specific interface
// - "", "0.0.0.0", "::" to listen on any interface
// Default, when address config is left out, is "localhost"
port: 8889,
ipWhitelist: [], // Set [] to allow all IP addresses
// or add a specific IPv4 of 192.168.1.5 :
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
`docker run -d \ --publish 80:8181 \ ... 1. Open my browser and navigate to http://localhost:8181 and... "localhost refused to connect".
The port outside on the host ist 80, so you have to navigate to http://localhost:80
FWIW, I'm using Unraid as my host and it didn't work until I set both the host and container port to the same port number and configured that port in the config.js
@c0degeekPL I tried changing the config.js as you suggested but no luck. I think I'll need to try changing the EXPOSE line you suggested also and rebuild the image and container.
I tested accessing localhost:80 as well as localhost:8080 and 8181 and all had the same response. Will do some more tweaking and give it another shot later. Thanks all!
@c0degeekPL the EXPOSE line change worked! I used the port you gave in your dockerfile and config.js file just to try something unique to my configuration. That, with docker run -d \ --publish 8889:8889
in my docker run command fixed my issues.
Thanks everyone for all your help!
@KamilLenica Could you test the latest build? See #33
@KamilLenica Could you test the latest build? See #33
Not right now, I am away on bussiness trip without access to my Raspberry.
Will do as soon as possible, but no sooner than 18th of February
I tested it on my raspberry pi. Works as expected 👍 Again thanks @khassel!
@KamilLenica Could you test the latest build? See #33
Running fne on Rpi 4
Linux raspberrypi 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux
See comment https://github.com/bastilimbach/docker-MagicMirror/issues/19#issuecomment-525050143 by @khassel