Docker Community Forums

Share and learn in the Docker community.

Dockerfile INCLUDE utility / reusable files

When I am writing a Dockerfile I want to include some utility functions such as iputils-*, bashrc alias, etc.

It would be nice if we could do (in the DOCKERFILE):

INCLUDE …/appliances/utils/apt-iputils
INCLUDE …/appliances/utils/apt-locate

Those files get pulled into the current docker file and those instructions are executed at that time. They wouldn’t be treated as real docker files, just commands that the current dockerfile could execute when included.

Of course, it won’t work to use apt install iputils-* on something that doesn’t use apt, so that would be up to the developer to figure out. It would be nice instead of copying code everywhere (DRY - don’t repeat yourself).


I am curious. Can you write an example how you would use it? I am not the one who could implement it but I would like to understand what I am missing, how could this feature help us. :slight_smile: