'Docker + Redis - fails to run command
First time trying docker with Laravel sail.
On first sail up I noticed the following error:
WARNING overcommit_memory is set to 0! Background save may fail under low memory condition
I followed instructions here to fix this issue, but I am now stuck with this error:
sh: ./init.sh: not found
My dir structure is:
e:\laravel-project
- docker-compose.yml
e:\Docker
$redis
- Dockerfile
- init.sh
- redis.conf
My docker-compose contains:
redis:
build:
context: "./../../Docker/Redis"
dockerfile: Dockerfile
image: "redis:alpine"
privileged: true
command: sh -c "./init.sh"
ports:
- "${FORWARD_REDIS_PORT:-6379}:6379"
volumes:
- "sail-redis:/data"
networks:
- sail
healthcheck:
test: ["CMD", "redis-cli", "ping"]
retries: 3
timeout: 5s
My Dockerfile (from the link) is:
# file: docker/redis/Dockerfile
FROM redis:alpine
WORKDIR /redis
COPY redis.conf /usr/local/etc/redis/redis.conf
COPY init.sh ./
RUN chmod +x init.sh
The init.sh file contains:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
sysctl -w net.core.somaxconn=512
sysctl vm.overcommit_memory=1
redis-server /usr/local/etc/redis/redis.conf --bind 0.0.0.0
The first error is not showing now which leads me to think the redis.conf file is being loaded.
redis exist with error and does not start:
exited with code 127
What have I missed on the init.sh file? Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
