Get-DockerStatsSnapshot.ps1
19 Sep 2025Description
Purpose
Retrieves the Docker container statistics snapshot.
Detailed Description
The Get-DockerStatsSnapshot function retrieves the current statistics snapshot of Docker containers. It checks if any Docker containers are running and displays the statistics if there are any. If no containers are running, a warning message is displayed.
Usage
Example 1
Get-DockerStatsSnapshot
Retrieves the Docker container statistics snapshot.
Notes
Author: Your Name Date: Date created
Script
<#
.SYNOPSIS
Retrieves the Docker container statistics snapshot.
.DESCRIPTION
The Get-DockerStatsSnapshot function retrieves the current statistics snapshot of Docker containers. It checks if any Docker containers are running and displays the statistics if there are any. If no containers are running, a warning message is displayed.
.NOTES
Author: Your Name
Date: Date created
.EXAMPLE
Get-DockerStatsSnapshot
# Retrieves the Docker container statistics snapshot.
#>
function Get-DockerStatsSnapshot {
$running = docker images -q
if ($null -eq $running) {
Write-Warning -Message "No Docker Containers are running"
}
else {
docker container stats --no-stream
}
}
Download
Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.
Report Issues
You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.