Docker Community Forums

Share and learn in the Docker community.

I'm trying to delete a container through Docker V2

I’m trying to delete a container through Docker V2 api as “DELETE ==> :https ://registry.hub.docker.com/v2/DockerUserName/DockerRepoName/manifests/sha256:xyz” is not working.

Steps I Followed to Work with Docker V2 api

Tool Used : Postman

1 ) I am able to get access_token(the one need to use to in digest of a given repo). The request will look like

Method : GET

Auth Type : basic Auth

Input To Auth : Username and Password

Url:

“https ://auth.docker.io/token?
service=registry.docker.io&scope=repository:DockerUserNameHere/TheRepoNameComesHere:pull,push/”

2 ) I am able to get list of Repo’s Containers using

Method : GET

Header Type : “Authorization”

Input To Header : “Bearer bearerTokenWeGotInStep1”(Make sure you Include Bearer before entering token)

Url: “https ://registry.hub.docker.com/v2/repositories/DockerUserNameHere/TheRepoNameComesHere/tags/?page_size=100”

3 ) Here We get all tags and with “Get”

Method : GET

Auth Type : OAuth2.0

Input To Auth : “AccessToken we got in step 1”

Url: “https ://registry.hub.docker.com/v2/Luffy1ps(#User_Name_in_Docker)/Namisan(#Repo_Name)/manifests/4638cc816dc70a28ioe8refuj5ad94e2(Tag_of_container)”

Wrote In “()” for clear understanding.

4 ) Here comes the problem deleting a container using manifest Id or Tag without any authorization

Method : DELETE

Url: https ://registry.hub.docker.com/v2/DockerUserName/DockerRepoName/manifests/sha256:Xyz"

So If any one have idea that, how can one delete that tags using V2 api. Thanks in advance

For reference :

Url: https://docs.docker.com/registry/spec/api/

1 Like