I created a pod which serve redis database and i want to leave it running when complete. Containers are meant to run to completion. Do i need to create and infinity loop which never ends ?
apiVersion: v1
kind: Pod
metadata:
name: redis
spec:
containers:
- name: redis
image: lfccncf/redis:latest
command: [ "/bin/bash", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
2
Answers
it is no need
delete it
If the container has a process which keeps running then you don’t need to use infinite loop. In this case the container will run the
redis
process.Thedockerfile
will have theRUN
command to execute the process.Also I suggest you use a standard redis image or a helm chart to deploy redis.
Here is guide on running PHP guestbook app with redis