I am trying to install Redis on the golang:1.10.1-alpine3.7
image. I tried RUN apk add --no-cache redis
, but when I tried to run the redis-cli
command, I get an exit status 127, which means the given command in not found. I would like to know how I would be able to run the redis-cli
command.
Install Redis on Alpine based image in docker
Asked Answered
Try using the fully qualified path of the command - /usr/bin/redis-cli
.
Try using the fully qualified path of the command - /usr/bin/redis-cli
.
Specify the version of alpina in the Dockerfile
From alpina:3.8
RUN apk add --update redis
CMD [ "redis-server" ]
It works fine with version 3.8 and when it use version 3.19 it doesn't work. https://dl-cdn.alpinelinux.org/alpine/v3.19/main: temporary error (try again later)
For Alpine I just copy the executable from a Redis image, like this:
This prevents from installing the 'whole' server suite when using apk install redis
.
FROM alpine:3.20
COPY --from=redis:7-alpine3.20 /usr/local/bin/redis-cli /usr/local/bin/redis-cli
RUN redis-cli -h redis DEL "KEY*"
© 2022 - 2024 — McMap. All rights reserved.
redis-cli
the command seems to run just fine. Perhaps try using the fully qualified path of the command -/usr/bin/redis-cli
– Shuping/usr/bin/redis-cli
. – Pelagian