https://docs.docker.com/compose/compose-file/#image
If the image does not exist on the platform, Compose implementations MUST attempt to pull it based on the pull_policy. Compose implementations with build support MAY offer alternative options for the end user to control precedence of pull over building the image from source, however pulling the image MUST be the default behavior.
https://docs.docker.com/compose/compose-file/build/#tags
tags defines a list of tag mappings that MUST be associated to the build image. This list comes in addition of the image property defined in the service section
If image is specified, pulling the image will be the default behavior, thus if you want to use local image only, you should not specify image.
tags in build section is the correct place to specify the tag of local image.
services:
backend:
build:
context: backend
dockerfile: ../backend.Dockerfile
tags:
- "myimage:mytag"