There can only be one CMD instruction in a Dockerfile. If you list more than one CMD then only the last CMD will take effect.
The main purpose of a CMD is to provide defaults for an executing container. These defaults can include an executable, or they can omit the executable, in which case you must specify an ENTRYPOINT instruction as well.
类似 Python 的变量声明，语句可以应用语句之后声明的变量，因为编译时会统一把变量声明提到前面去