| external help file | psdocker-help.xml |
|---|---|
| Module Name | psdocker |
| online version | https://abbgrade.github.io/psdocker/docs/Remove-DockerContainer.html |
| schema | 2.0.0 |
Remove a Docker container.
Remove-DockerContainer [-Name] <String> [-Force] [[-Timeout] <Int32>] [[-StopTimeout] <Int32>]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
Removes a container, optionally stopping it first with -Force. Supports -WhatIf and -Confirm. Wraps the Docker CLI `rm` command.
# Prerequisites: Docker is running and can pull images from Microsoft Container Registry.
Install-DockerImage -Repository 'mcr.microsoft.com/powershell' -Tag 'latest' | Out-Null
$name = "psdocker-example-$([guid]::NewGuid().ToString('N'))"
New-DockerContainer -Image 'mcr.microsoft.com/powershell:latest' -Name $name -Detach -ArgumentList @('sleep','infinity') | Out-Null
Remove-DockerContainer -Name $name -Force
Creates a temporary container, then removes it by name. Captured output: No output. The container is removed.
# Prerequisites: Docker is running and can pull images from Microsoft Container Registry.
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')
$container | Remove-DockerContainer -Force
Creates a temporary container, then stops and removes it through the pipeline. Captured output: No output. Matching containers are stopped and removed.
Specifies the name of the container that should be removed.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies if the container should be stopped before removal.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the number of seconds to wait for the command to finish.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: 10
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the timeout of the Docker client command for the stop operation.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: 10
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePrompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
https://abbgrade.github.io/psdocker/docs/Remove-DockerContainer.html