O'Reilly logo

Docker and Kubernetes for Java Developers by Jaroslaw Krochmalski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ONBUILD

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:

ONBUILD <INSTRUCTION>

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required