1. Docker Official Documentation, docker build command reference: "The -t, --tag flag... Name and optionally a tag in the 'name:tag' format." This source confirms that -t is the correct flag for tagging an image during the build process.
Source: Docker Inc., Docker Docs, "docker build," https://docs.docker.com/engine/reference/commandline/build/#tag
2. Docker Official Documentation, docker run command reference: This document details the valid options for the docker run command, including -p for port mapping and -t for allocating a pseudo-TTY. It confirms these flags are not part of the docker build command.
Source: Docker Inc., Docker Docs, "docker run," https://docs.docker.com/engine/reference/commandline/run/#options
3. Docker Official Documentation, docker tag command reference: "Creates a tag TARGETIMAGE that refers to SOURCEIMAGE." This clarifies that docker tag operates on an already existing image, which highlights the confusing premise in the question but does not change the correct answer for building with a tag.
Source: Docker Inc., Docker Docs, "docker tag," https://docs.docker.com/engine/reference/commandline/tag/