psdocker integrates Docker into PowerShell-based DevOps workflows, including test automation. It wraps the Docker CLI with commands to find and manage images and containers, and to run commands inside containers.
For details, visit the GitHub Pages.
Make sure PowerShell 7.0 or later and the Docker CLI are installed. You can install Docker, for example, via Chocolatey or Docker Desktop.
Install psdocker from the PowerShell Gallery in a PowerShell session:
Install-Module -Name psdocker -Scope CurrentUserWith Docker running and access to Microsoft Container Registry, pull a PowerShell image, start a container, run a command in it, and remove it:
Install-DockerImage -Repository 'mcr.microsoft.com/powershell' -Tag 'latest' | Out-Null
$name = "psdocker-example-$([guid]::NewGuid().ToString('N'))"
$container = New-DockerContainer -Image 'mcr.microsoft.com/powershell:latest' -Name $name -Detach -ArgumentList @('sleep', 'infinity')
try {
Invoke-DockerCommand -Name $container.Name -Command 'echo' -ArgumentList 'hello' -StringOutput
}
finally {
Remove-DockerContainer -Name $container.Name -Force
}This project uses a build script based on Invoke-Build.
For installation details, see the Invoke-Build documentation; we recommend Install-Module InvokeBuild -Scope CurrentUser.
The documentation is generated with platyPS, so you may also want to run Install-Module PlatyPs -Scope CurrentUser.
You can run the build by:
- PowerShell: execute
Invoke-Buildin a PowerShell session in the project directory - VS Code: run the integrated build task feature (F1 + "Tasks: Run Build Task")
This project uses test scripts based on Pester.
For installation details, see the Pester documentation; we recommend Install-Module Pester -Scope CurrentUser.
You can run the tests by:
- PowerShell: execute
Invoke-Build Testin a PowerShell session in the project directory - VS Code: run the integrated test task feature (F1 + "Tasks: Run Test Task")
For debugging tests, change the working directory to ./test, set a breakpoint in VS Code, and start debugging with F1 + "Debug: Start Debugging".
See the command reference for descriptions and examples.
See the changelog file.
Thanks to the contributors of this project:
- Steffen Kampmann
- Marc Kassay