Docker build and bridge networks

I am faced with a requirement where I need to create an image and one of the steps in this image creation is to configure an application which uses a database that is running in another container (let’s name it as db4app).

The database container (db4app) is running in a user-defined bridge network (say network4app).

The issue I am facing here is when I use the name of the database container for running the configuration step, the host is not resolved as the intermediate container created by the docker build step is not in the same user-defined network.

The question I have:
Can we start the intermediate containers that are created during the docker build steps in a specific user-defined network?

I tried checking the dockerfile reference document (https://docs.docker.com/engine/reference/builder/) but I donot find any relevant help in it.

As I am new to Docker, I would appreciate any help with respect to this issue.