redis / docker-library-redis

Docker Official Image packaging for Redis
http://redis.io
BSD 3-Clause "New" or "Revised" License
1.12k stars 563 forks source link

Loading module during build is not working on Apple M1 #303

Closed bridge-jithesh closed 2 years ago

bridge-jithesh commented 2 years ago

Below is my Dockerfile:

FROM redis
ARG MASTER_AUTH
COPY redis.conf /usr/local/etc/redis/redis.conf
RUN mkdir -p /usr/local/etc/redis/modules
COPY ./modules /usr/local/etc/redis/modules
RUN chmod +x /usr/local/etc/redis/modules/librejson.so
RUN chmod +x /usr/local/etc/redis/modules/redisearch.so
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]

as you can see I am copying all my modules into the container during the build. But I am getting the below error when trying to start the container.

[+] Running 1/1
 ⠿ Container redis-replica  Recreated                                                                    0.1s
Attaching to redis-replica
redis-replica  | 1:C 11 Jan 2022 17:20:27.486 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis-replica  | 1:C 11 Jan 2022 17:20:27.486 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=1, just started
redis-replica  | 1:C 11 Jan 2022 17:20:27.486 # Configuration loaded
redis-replica  | 1:S 11 Jan 2022 17:20:27.487 * monotonic clock: POSIX clock_gettime
redis-replica  | 1:S 11 Jan 2022 17:20:27.487 * Running mode=standalone, port=6379.
redis-replica  | 1:S 11 Jan 2022 17:20:27.487 # Server initialized
redis-replica  | 1:S 11 Jan 2022 17:20:27.488 # Module /usr/local/etc/redis/modules/librejson.so failed to load: /usr/local/etc/redis/modules/librejson.so: cannot open shared object file: No such file or directory
redis-replica  | 1:S 11 Jan 2022 17:20:27.488 # Can't load module from /usr/local/etc/redis/modules/librejson.so: server aborting
redis-replica exited with code 1

Now the reason I put Apple M1 on the title is that the same Dockerfile is working fine on all other platforms. I've tested it with Ubuntu 20 LTS, WSL2 on Windows. Works absolutely fine. I have the error only on my Apple M1.

How I should debug this?

tianon commented 2 years ago

This sounds like your modules are compiled for amd64, but for the M1 they need to be arm64v8 (or you need to run with amd64 emulation enabled instead, which will be slower).

wglambert commented 2 years ago

Closing since this seems resolved, if you need further help you could also try asking over at the Docker Community Forums, Docker Community Slack, or Stack Overflow