skip to Main Content

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


  1. it is no need

    command: [ "/bin/bash", "-c", "--" ]
    args: [ "while true; do sleep 30; done;" ]enter code here
    

    delete it

    Login or Signup to reply.
  2. 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.The dockerfile will have the RUN 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search