Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

How to find out package disk space?



  • Dealing with a low disk space situation, I'm having trouble locating which docker packages are taking up space. I know from the "manage registry" page that the whole feed is taking up some 99% of the disk, which isn't really helping me.

    I need to know how much disk space is claimed by each package - each of which can have hundreds of tagged versions. Is this information available anywhere?



  • @peter-hamberg_8356 said in How to find out package disk space?:

    I need to know how much disk space is claimed by each package - each of which can have hundreds of tagged versions. Is this information available anywhere?

    I agree that this could be a very useful addition. Actually the best way to do what you describe is to estimate the sum of the sizes of all images layers, which is not very convenient...



  • I managed to get somewhat what I needed from the native api.
    I wrote this script which displays the sum of each image layers, grouped by package

    $key = "<key with native api access>"
    $uribase="http://<proget server>/api/json/"
    $feedid = <feed id>
    $packages = Invoke-webrequest "$($uribase)DockerImages_GetRepositories?key=$($key)&Feed_ID=$feedid" | select -expandproperty Content | convertfrom-json
    
    $size_lookup = @{}
    
    
    $data = @()
    $total = $packages.length
    $count = 0;
    $packages | %{
    	$n = [uri]::EscapeDataString($_.Repository_Name)
    	$progressPreference = 'silentlyContinue'
    	$images = Invoke-webrequest "$($uribase)DockerImages_GetImages?key=$($key)&Feed_ID=$($feedid)&Repository_name=$n" | select -expandproperty Content | convertfrom-json
    	$progressPreference = 'Continue'
    	$images | %{
    
    		$manifest = [System.Text.Encoding]::UTF8.GetString( [Convert]::FromBase64String($_.ManifestJson_Bytes) ) | convertfrom-json
    		$layers = $manifest.layers
    		$sizesum = $layers | ?{$_.size -ne $null } | measure -sum size | select -ExpandProperty sum
    		$obj = @{}
    
    		$obj.Add("Feed",$_.feed_id)
    		$obj.Add("Repository",$_.Repository_name)
    		$obj.Add("Manifest",$manifest )
    		$obj.Add("Layersum", $sizesum )
    		$obj.Add("DownloadCount",$_.Download_Count)
    		$obj.Add("Published",$_.Published_Date)
    		$data += $obj
    
    	}
    
    	$count++
    	write-progress -PercentComplete ($count*100/$total) -Activity "Working..."
    }
    
    $data | convertto-json -depth 99 | set-content -encoding utf8 out.json
    
    $data | group-object Repository | %{
    	$s=$_.group | measure -sum layersum | select -ExpandProperty sum;
    	$n = $_.name;
    	new-object psobject -Property @{"name"=$n;"size"=$s}
    } | sort-object size
    
    
    
    
    

  • inedo-engineer

    Great solution, thanks for sharing @Zazcallabah



  • @apxltd Can we expect this feature to be added to ProGet anytime soon ?


  • inedo-engineer

    In ProGet 5.3, we plan to have a couple tabs on each Tag (i.e. container image) that would provide this info: Metadata (will be a key/value pair of a bunch of stuff), and Layers will show details about each of these layers.

    That might help, but otherwise, we have retention policies which are designed to clean up old and unused images.We'll also have a way to detect which images are actually being used :)


  • inedo-engineer

    Just a quick in-progress preview of what we've got coming; feedback welcome!

    2aefec08-0033-4d19-8dad-bb75849bbcce-image.png


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation