Docker

Docker

Made by DeepSource

ONBUILD, FROM or MAINTAINER triggered from within ONBUILD instruction DOK-E1002

Bug risk
Major

The ONBUILD instruction adds to the image a trigger instruction to be executed at a later time, when the image is used as the base for another build.

The trigger will be executed in the context of the downstream build, as if it had been inserted immediately after the FROM instruction in the downstream Dockerfile.

Hence, these three cases are errors in Dockerfiles.

Bad Practice

ONBUILD ONBUILD /bin/true  # Chaining ONBUILD isn't allowed
ONBUILD FROM debian  # FROM doesn't work with ONBUILD
ONBUILD MAINTAINER Ron Weasley  # MAINTAINER doesn't work with ONBUILD

Recommended

ONBUILD /bin/true
FROM debian
MAINTAINER Ron Weasley

References