docker inspect 결과:
OOMKilled=true (exit=137)
→ 메모리 부족(OOM Kill) 이 원인.
확인 방법
docker inspect redis-container --format '{{.State.OOMKilled}} (exit={{.State.ExitCode}})'
*redis-container는 docker에 있는 이름을 확인하세요.
docker exec -it redis-container redis-cli dbsize
docker exec -it redis-container redis-cli info memory | egrep 'used_memory_human|maxmemory'
Docker Desktop 메모리 늘리기
1) Settings Settings → Resources → Memory에서 팀원과 동일하게 맞춤(권장 4GB 이상).
2) Apply & Restart.
Redis 메모리 제한 설정
docker-compose.yml
예시
services:
redis:
image: redis:7.2
command:
- redis-server
- --maxmemory
- 256mb
- --maxmemory-policy
- allkeys-lru
- --appendonly
- "no"
- --daemonize
- "no"
ports:
- "6379:6379"
mem_limit: 512m
restart: unless-stopped
나의 원인은 1번 (Docker Desktop 메모리 설정) 때문이었고,
Docker Desktop → Settings → Resources → Memory Limit
값을 늘리자, Redis 컨테이너가 더 이상 종료되지 않았다.