Powershell Cmdlets that wrap the docker client and support the interaction with containers
New container
New-DockerContainer [[-Name] <String>] [-ImageName] <String> [[-Environment] <Hashtable>]
[[-Ports] <Hashtable>] [[-Volumes] <Hashtable>] [[-Timeout] <Int32>] [[-StatusTimeout] <Int32>] [-Detach]
[-Interactive] [-Terminal] [-Remove] [-StringOutput] [[-ArgumentList] <String[]>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
Creates a new container in the docker service. Wraps the command `docker run`.
New-DockerContainer -Image 'microsoft/nanoserver' -Name 'mycontainer'
Image : microsoft/nanoserver
Ports :
Command : "c:\\windows\\system32\\cmd.exe"
Created : 14 seconds ago
Name : mycontainer
ContainerID : 1a0b70cfcfba78e46468dbfa72b0b36fae4c30282367482bc348b5fcee0b85d3
Status : Exited (0) 1 second ago
Specifies the name of the new container. If not specified, a name will be generated.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies the name of the image to create the container from.
Type: String
Parameter Sets: (All)
Aliases: Image
Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies the environment variables to use during container creation.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies the port mappings for the created container.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies the volumes to mount, mapping host paths to container paths.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies the number of seconds to wait for the command to finish.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: 30
Accept pipeline input: False
Accept wildcard characters: False
Specifies the timeout of the Docker client for the container lookup after creation.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: 1
Accept pipeline input: False
Accept wildcard characters: False
Runs the container without a connection to the client shell.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Connects the container’s standard input to the client.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Allocates a pseudo-TTY.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Automatically removes the container when it exits.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Returns the Docker command output as a string.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the command and arguments to run in the container.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.