The CMD instruction has three forms:
CMD ["executable","param1","param2"] (exec form, this is the preferred form)
CMD ["param1","param2"] (as default parameters to ENTRYPOINT)
CMD command param1 param2 (shell form)
Because it does not exist. The answer is what @terpz pointed out. When you use the exec syntax which makes CMD to be the argument of the entrypoint, every entry that you put between quotation marks are considered to be one file path not a command an its arguments.
The correct way is:
CMD ["sh", "/home/script.sh"]
You really want to use the exec form, because the other would not be the argument of the entrypoint and could work differently or not work at all.
And you can probably use the CMD without the âshâ part:
Furthermore, your ENTRYPOINT and CMD combination would result in the command /entrypoints.sh "sh /home/script.sh", as CMD will be the argument to ENTRYPOINT.
If you declare CMD as CMD [/"home/script.sh"], the container will execute /entrypoint.sh /home/script.sh.
Note: make sure both scripts are executable. For /entrypoint.sh you depend on the +x permissions being set on the host, as you donât set in your Dockerfile explicitly, like you did for /home/script.sh.