Delete only selected tags from the Container Registry
### Problem to solve The GitLab Container Registry allows users to build, push and share Docker images/tags using the [Docker client](https://docs.gitlab.com/ee/user/project/container_registry.html#build-and-push-images), [GitLab CI](https://docs.gitlab.com/ee/ci/docker/using_docker_build.html) or the [GitLab API](https://docs.gitlab.com/ee/api/container_registry.html). At `/container_registry` users can view and manage their images/tags. However, if an image has multiple tags, clicking delete on any of the tags deletes all tags with the same image id. This is due to a limitation with the Docker API, which does not allow for the deletion of a single tag. The issue has been [raised with Docker](https://github.com/docker/distribution/pull/2169), but has not been addressed in over two years. This is problematic for users that expect to be able to delete a single tag and end up accidentally deleting multiple tags. Several users have suggested workarounds for this problem, but we have yet to incorporate any of them into the GitLab UI. #### Example ![image](/uploads/befd42d9c5b6a0fe180ef467368b4539/image.png) I've clicked 'delete' on line with `Name` = `5ede343b167a188a8349fc7594389c9c725cecab`: ![image](/uploads/a32367c23cc555ca0e215ff0b022a36c/image.png) ### Intended users - [Software Developer](https://design.gitlab.com/getting-started/personas#persona-sasha) - [DevOps Engineer](https://design.gitlab.com/getting-started/personas#persona-devon) - [Systems Administrator](https://design.gitlab.com/getting-started/personas#persona-sidney) ### Proposal Update the container registry UI, to allow users to remove a single tag, without removing all tags with the same `TagID`. - Since Docker distribution deletes all tags which point to same image, we can delete just one tag by pushing a different image into it and then deleting the tag. - When the tag is the last tag for the image, do not apply the substitution, delete the actual image and not the dummy ### Further details #### Community Contributions - https://gitlab.com/gitlab-org/gitlab-ce/issues/21405#note_66291640 - https://gitlab.com/gitlab-org/gitlab-ce/issues/21405#note_144535095 - https://github.com/glensc/docker-create-tag #### UX considerations - https://gitlab.com/gitlab-org/gitlab-ce/issues/24705 will give users the ability to select and remove multiple images/tags at once. As part of that change, it's important that only images/tags that are selected are removed. - https://gitlab.com/gitlab-org/gitlab-ce/issues/62559 added a warning modal, which can be removed if we address this issue. ### Permissions and Security * Developers, maintainers, and owners will all have the ability to untag multiple images/tags. * For the [Container Registry API](https://docs.gitlab.com/ee/api/container_registry.html) we do not allow developers to bulk delete images, but since they are manually selecting the images, we can allow it. ### Documentation - [Container Registry user docs](https://docs.gitlab.com/ee/user/project/container_registry.html) ### Testing - We need to test that the untagging behavior works as expected and that only items selected are removed. ### What does success look like, and how can we measure that? Success looks like we have resolved the core issue and users can begin to rely on the user interface for managing their Container Registry. Once resolved, we should see an increase in the amount of images that are untagged. #### Metrics | Priority | Category | Metric | Aggregated by | SMAU Eligible? | Data available? | | ------ | ------ | ------ | ------ | ------ | ------ | | P1 | Container Registry | # of page views of `/container registry`| <ul><li>Time: day/week/month/quarter/year </li><li>Instance: Self-managed CE/Self-managed EE</li><li>Account type: Core/Starter/Premium/Ultimate</li></ul> | Yes | ? | | P1 | Container Registry | # of images/tags deleted one at a time from the UI | <ul><li>Time: day/week/month/quarter/year </li><li>Instance: Self-managed CE/Self-managed EE</li><li>Account type: Core/Starter/Premium/Ultimate</li></ul> | Yes | ? | | P1 | Container Registry | # of images/tags deleted in bulk from the UI| <ul><li>Time: day/week/month/quarter/year </li><li>Instance: Self-managed CE/Self-managed EE</li><li>Account type: Core/Starter/Premium/Ultimate</li></ul> | Yes | ? | ### Links / references - [Multi-select for deleting images](https://gitlab.com/gitlab-org/gitlab-ce/issues/24705) - [Docker issue for supporting deleting a single tag](https://github.com/docker/distribution/pull/2169)
issue