The ONBUILD instruction specifies an additional instruction which will be triggered when some other image is built by using this image as its base image. In other words, the ONBUILD instruction is an instruction the parent Dockerfile gives to the child Dockerfile (downstream build). Any build instruction can be registered as a trigger and those instructions will be triggered immediately after the FROM instruction in the Dockerfile.
The syntax of the ONBUILD instruction is as follows:
Within this, <INSTRUCTION> is another Dockerfile build instruction, which will be triggered later when the child image is going to be built. There are some limitations: the ONBUILD instruction does not allow the chaining of another ...