Then, want you to make several services, tagged with several names? Maybe you should create a docker-compose.yaml file to define all of those images tag. Every Service has his own directory, in which there is the Dockerfile runned when by docker-compose.yaml when you launch
docker-compose run
Have a look at this project, I think that you want something like that: https://github.com/Aragorn1992gb/multi-docker4/blob/master/docker-compose.yml
Using this approach, you will have n different images as n services you built. Docker compose will link all of those services to work all together. In the example you can see that there are'postgres' and 'redis' service that load a pre-built image from docker-hub. Then there are also 'nginx', 'api', 'client' and 'worker' services, that follow the Dockerfile.dev inside their folders.
To be more clear, a service tag can be different from the folder name of the service. Have a look to 'api' service:
- it depends on postgres (this is the relationship)
- his image is built by Dockerfile.dev file (you use .dev only in development environment). It is stored on "server" folder, then copied inside the container at app folder (./server:app)
- it has some volumes in some directories (that means when you change something in those folders, the application will takes the updates without re-generate the image)
- environment specify some env variables
Hoping that this can help you
UPDATES: reading better your question, the approach is similar and the images are, of course, different.
docker build
(or its equivalent) multiple times on the same source tree, you will get the same image; for example,docker images
should show you the same image ID with multiple tags. Is that what you're asking about?