1

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?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Alex I
  • 2,078
  • 3
  • 18
  • 24

1 Answers1

3

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).

David Maze
  • 130,717
  • 29
  • 175
  • 215
Max Skoryk
  • 404
  • 2
  • 10
  • How about Windows? – Alex I Feb 18 '22 at 19:23
  • Don't have much experience with the Windows command line, but the operators behave the same according to multiple sources. E.g., https://en.wikibooks.org/wiki/Windows_Batch_Scripting – Max Skoryk Feb 18 '22 at 22:30