Docker Community Forums

Share and learn in the Docker community.

Build context vs. custom build hooks


(Daniel Nüst) #1

The build hooks documentation states that…

To override these phases, create a folder called hooks in your source code repository at the same directory level as your Dockerfile.

I am working on a repository with multiple Dockerfiles and we want to automate tag generation with build hooks (see issue on GitHub).

On Docker Hub, does the build context influence where the hooks directory is expected?

In other words: In a repository with 10+ Dockerfiles all using the same post_build hook, can we safe the duplication of said hook file on Docker Hub?

(Threevl) #2

It most absolutely does on Docker cloud. The hooks folder should be next to the Dockerfile. This tripped me up for a few hours this morning. You questions led me to try changing the location of the hooks directory and that did it!

(Daniel Nüst) #3

Glad my question could help. It would still be great if many Dockerfiles could use the same hook if they are in one repository with multiple automatic builds.