On Generating docker Images in Continuous Integration

  docker, question

Now i use gitlab’s ci for continuous integration. The final step is to generate a mirror file..gitlab-ci.ymlThe configuration is as follows:

...
 docker-image:
 tags:
 - xxx
 stage: docker-image
 script:
 - echo $PWD
 - docker build -t xxx/yyy .

But every time I integrate, the original image still exists.
图片描述

Is there any command that can directly replace the original image, or does it need to add another command to delete the original image first?
Also, when uploading to docker registry, is it necessary to delete the mirror image originally placed in registry?

Previous versions of the mirror should be retained for a certain period of time to facilitate fast rollback operations. If hard disk space is limited, you can write scheduled tasks to periodically delete some mirrors.