I have a docker image generated from my build process. I am looking to tag the latest build image with tag build id and 'latest'. I see two ways to do this.
First approach - (Add Multiple tags and Push once)
docker tag <id> <user>/<image>:build_id
docker tag <id> <user>/<image>:latest
docker push <user>/<image>
Second - Tag individually and push
docker tag <id> <user>/<image>:build_id
docker push <user>/<image>:build_id
docker tag <id> <user>/<image>:latest
docker push <user>/<image>:latest
The docker documentation says if there is an image in the registry with a specific tag already, then docker push with a new image with same tag would overwrite the earlier image.
- Are both First and Second Option specified above functionally the same?
- Is there any preferred way/Best practice?