首页 文章

如何通过命令行从docker hub删除docker镜像?

提问于
浏览
3

我创建了docker镜像以便在我的Jenkins管道中进行测试,将其上传到Docker hub并将其部署到Kubernetes . 在测试过程结束时,我想从Docker hub(而不是从测试机器)中删除测试图像 . 如何从命令行删除docker hub映像?

1 回答

  • 6

    使用Docker Hub API,如下所述:https://docs.docker.com/v1.7/reference/api/docker-io_api/#delete-a-user-repository

    我刚用curl测试了一个测试图像的删除:

    curl -X DELETE -u "$user:$pass" https://index.docker.io/v1/repositories/$namespace/$reponame/
    

    分别用Docker Hub上的用户和密码替换 $user$pass ;并替换 $namespace (在我的情况下,它与 $user 相同)和 $reponame 与图像名称(在我的情况下是 test ) .

相关问题