How to tag an image in a Dockerfile? [duplicate]
Matthew Barrera
I have been digging the documentation, but I did not find an instruction to define the tag name of an image in a Dockerfile. There is one available for the command line though.
Say I create an image FROM another image, I don't want it to bear the same name. How should I proceed?
1 Answer
Unfortunately it is not possible. You can use build.sh script, which contains like this:
#!/usr/bin/env bash
if [ $# -eq 0 ] then tag='latest' else tag=$1
fi
docker build -t project:$tag .Run ./build.sh for creating image project:latest or run ./build.sh your_tag to specify image tag.