HI Team, What is the difference between these two commands command: ['sh', '-c', . . .

Muhibullah Khalid:
HI Team,
What is the difference between these two commands
command: [‘sh’, ‘-c’, ‘sleep 20’] (This one is used for init continers with single inverted coma’s) and command: [“sleep”,“20”] This is used in normal POD command. The same command does not work for the init conainter.

Basavraj Nilkanthe:
Hello @Muhibullah Khalid. These are exec form for declaring docker instructor like RUN/CMD/ENTRYPOINT… which is similar to commands and args in kubernetes. There are two way you can pass command to these instructor… Shell and Exec form… Preferred one is exec form… However in exec form… If run command for example…“sleep”,“30”… This will be directly execute without shell processing and in initContainer command… It call shell because it has sh and then command by passing -c… In your case I need to know if both are using same image or different image??. Assuming both are different image … It means in dockerfile of second pod image they must be hard coded entry point instructor to call shell . if you share your yaml definition… I can cross check

Basavraj Nilkanthe:
Generally this problem will cover when you are passing environment variable… Exec form won’t print environment variable value when it execute directly without shell processing… So it is recommended to call shell either passing sh or /bin/bash before commands…