Rock Docker with PowerShell
Rocker is a PowerShell module that makes Docker a bit cooler.
It allows docker to work with PowerShell's object pipeline, so you can pipe one step into the next.
It also gives you tab completion for any command in docker.
Install-Module Rocker -Scope CurrentUser
Import-Module Rocker -Force -PassThru
# Get Docker Help
docker help
# Get Docker Help for a specific command
docker help run
# Run a script in a container
docker run mcr.microsoft.com/powershell {
"Hello from Docker! $pid"
}
# Run an nginx container, publishing port 8080 on the host.
docker run --detach @{8080=80} nginx
# Run a script in a container,
# mount the current directory,
# and set an environment variable.
docker run @{
"$pwd"="/mnt"
message='Hello from Docker!'
} mcr.microsoft.com/powershell {
"$($env:message) $(@(Get-ChildItem /mnt -recurse -File).Length) files mounted."
}
# List all containers
docker container ls |
docker diff # show their differences from the image.
# List all containers,
docker container ls |
docker container pause
# and pause them.
# List all containers,
docker container ls |
docker container unpause
# and start them up again.
# List all containers.
docker container ls |
docker history
# get their history
# Stop all running containers.
docker container ls |
docker container stop
# Get system disk information
docker system df
# Get system info
docker system info