'Understanding && and || in dockerfile

I am somewhat new to docker, and trying to understand why && and || mean in dockerfile RUN command. Is there a documentation that explains how they work?



Solution 1:[1]

These are standard Bourne shell script operators. In short: the code after each && will be evaluated only if part before these symbols is finished with exit code 0 (i.e., successfully). || is exactly the opposite, in that the code after it will be evaluated only if what was before the symbols finished with a non-zero exit code (i.e., failed).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Maze