Image tagging is not supported in Dockerfile. This should be done on your build team. As a workaround, you can build using docker-compose.yml, which identifies the name of the target image, and then run docker-compose build . An example docker-compose.yml will look like
version: '2' services: man: build: . image: dude/man:v2
However, there is a push against building an assembly with compose, as this does not work in swarm mode. So, you are back to running the command, as you asked in your question:
docker build -t dude/man:v2 .
Personally, I usually collect a small shell script in my folder (build.sh), which passes any arguments and includes the name of the image to preserve typing. And for production, the assembly is processed by the ci / cd server, whose name is inside the pipeline script.
BMitch Aug 17 '16 at 1:08 2016-08-17 01:08
source share