diff --git a/CI_CD_PIPELINE_SETUP_GUIDE.md b/CI_CD_PIPELINE_SETUP_GUIDE.md index 2de1062..b7bb16a 100644 --- a/CI_CD_PIPELINE_SETUP_GUIDE.md +++ b/CI_CD_PIPELINE_SETUP_GUIDE.md @@ -605,10 +605,29 @@ curl http://localhost:5000/v2/test/tags/list docker rmi localhost:5000/test:latest docker pull localhost:5000/test:latest -# Clean up test image +# Clean up test image completely +# Remove from local Docker docker rmi localhost:5000/test:latest + +# Delete test image from registry using registry API +# Get the digest of the latest tag +DIGEST=$(curl -s -H "Accept: application/vnd.docker.distribution.manifest.v2+json" http://localhost:5000/v2/test/manifests/latest | grep -o '"digest":"[^"]*"' | cut -d'"' -f4) + +# Delete the manifest from registry +if [ ! -z "$DIGEST" ]; then + echo "Deleting test image from registry..." + curl -X DELETE http://localhost:5000/v2/test/manifests/$DIGEST +else + echo "Could not find digest for test image" +fi + +# Clean up test file rm /tmp/test.Dockerfile +# Verify registry is empty +echo "Registry contents after cleanup:" +curl http://localhost:5000/v2/_catalog + # Exit SERVICE_USER shell exit ```