This switch is optional. It is not required if Dockerfile resides in the current directory (which is implied by the trailing period)
As per https://docs.docker.com/reference/cli/docker/image/build/
By default the docker build
command looks for a Dockerfile
at the root of the build context. The -f
, --file
, option lets you specify the path to an alternative file to use instead. This is useful in cases that use the same set of files for multiple builds. The path must be to a file within the build context. Relative path are interpreted as relative to the root of the context.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin