Nothing to do with Dockerfiles. You probably run too many compose projects and there are no available ipranges left for your new projects. Delete the old networks.
I reopened this topic without thinking about the actual question, but I really can’t follow your logic. You had a docker network issue while asking about a Dockerfile and now you asked for reopening the topic because you got no answer to a post that just confuses people even more. You quoted my statement about your issue not being related to Dockerfile because it wasn’t, and referred to a stack overflow post about “additional contexts”, which was at least related to your actual issue but you said nothing about realizing that you shared the wrong error message for example. I really have no time to trying to figure out every topic, so in those cases you can assume you will either not get a reply or will get it much later.
Regarding additional contexts, your error message is still clear. The file cannot be found. The stackoverflow post shared the documentation to the additional_contexts option and the way you used it, it is for referring to another folder, but you use it as if you could refer to an image which was not even built. You only have the Dockerfile. So you could only copy the Dockerfile, but even then, you wouldn’t have a “test” subfolder. The external context is the external folder.
I think the topic you opened to ask for reopening this was referring to “Multi-stage”, but if you want that, you can find that by searching for multi-stage
What you are doing is not that. By the way, the cat command wouldn’t work either since you built the image from scratch, so there is no cat or anyhing else in that image.