Normally this isn't supported by dockerfile and hence the docker build command is used.
Well there is a workaround - you can try using docker-compose.yml file as it easily identifies the target image name, so if you run the docker-compose build command it will work.
Make sure your docker-compose file looks something like this :
version: '2'
services:
man:
build: .
image: guy/dude:v2
But this isn't standard, you should rather try running a small shell script that will pass all the arguments and also will include the docker image name.
Incase of production the build can be handled by jenkins or whichever CI/CD server you are using, it will have the name of the image inside the pipeline code.
Hope that helped :)
Docker can be a little tough to understand without the help of people who have actual industry experience, so if you are interested try docker training course.