The short answer is, you cannot chain together commands in the exec form.
&&
is a function of the shell, which is used to chain commands together. In fact, when you use this syntax in a Dockerfile, you are actually leveraging the shell functionality.
If you want to have multiple commands with the exec form, then you have do use the exec form to invoke the shell as follows...
CMD ["sh","-c","mkdir -p ~/my/new/directory/ && cd ~/my/new/directory && touch new.file"]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…