New-Container

New-Container

Creates a container from an existing container image.

Syntax

Parameter Set: Container Image Identifiers
New-Container [[-Name] <String> ] [-AsJob] [-CimSession <CimSession[]> ] [-ComputerName <String[]> ] [-ContainerImageName <String> ] [-ContainerImagePublisher <String> ] [-ContainerImageVersion <Version> ] [-Credential <PSCredential[]> ] [-MemoryStartupBytes <Int64> ] [-Path <String> ] [-SwitchName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: Container Image Object
New-Container [[-Name] <String> ] -ContainerImage <ContainerImage> [-AsJob] [-MemoryStartupBytes <Int64> ] [-Path <String> ] [-SwitchName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detaillierte Beschreibung

The New-Container cmdlet creates a container from an existing container image.

Parameter

-AsJob

Indicates that this cmdlet runs the command as a background job on a remote computer. Use this parameter to run commands that take an extensive time to complete.

When you use AsJob, the command returns an object that represents the job, and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the Job cmdlets. To get the job results, use the Receive-Job cmdlet.

For more information about Windows PowerShell background jobs, see about_Jobs (https://go.microsoft.com/fwlink/?LinkID=113251) and about_Remote_Jobs (https://go.microsoft.com/fwlink/?LinkID=135184).

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-CimSession<CimSession[]>

Das Cmdlet wird in einer Remotesitzung oder auf einem Remotecomputer ausgeführt. Geben Sie einen Computernamen oder ein Sitzungsobjekt ein, wie z. B. die Ausgabe eines New-CimSession oder Get-CimSession-Cmdlets. Der Standardwert ist die aktuelle Sitzung auf dem lokalen Computer.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-ComputerName<String[]>

Specifies one or more Hyper-V hosts to run the cmdlet. NetBIOS names, IP addresses, and fully-qualified domain names are allowable. The default is the local computer. Use "localhost" or a dot (".") to specify the local computer explicitly.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-ContainerImage<ContainerImage>

Specifies the container image to build the container from.

Aliase

none

Erforderlich?

true

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

true(ByValue)

Platzhalterzeichen akzeptieren?

false

-ContainerImageName<String>

Specifies the name of the container image from which to build the container.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-ContainerImagePublisher<String>

Specifies the publisher of the container image from which to build the container.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-ContainerImageVersion<Version>

Specifies the version of the container image from which to build the container.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Credential<PSCredential[]>

Specifies a user account that has permission to perform this action. The default is the current user.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-MemoryStartupBytes<Int64>

Specifies the amount of memory, in bytes, to assign to the container.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Name<String>

Specifies the name of the container that this cmdlet creates.

Aliase

none

Erforderlich?

false

Position?

1

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Path<String>

Specifies the directory in which to store the files for the container that this cmdlet creates.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-SwitchName<String>

Specifies the friendly name of a virtual switch. Specify this parameter if you want to connect the new container to an existing virtual switch to provide connectivity to a network.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Confirm

Fordert Sie vor der Ausführung des Cmdlet zum Bestätigen auf.

Erforderlich?

false

Position?

named

Standardwert

false

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-WhatIf

Zeit, was passieren würde, wenn das Cmdlet ausgeführt wird. Das Cmdlet wird nicht ausgeführt.

Erforderlich?

false

Position?

named

Standardwert

false

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

<CommonParameters>

Dieses Cmdlet unterstützt die allgemeinen Parameter: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer und -OutVariable. Weitere Informationen finden Sie unter about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Eingaben

Der Eingabetyp ist der Typ der Objekte, die Sie per Piping an das Cmdlet übergeben können.

Ausgaben

Der Ausgabetyp ist der Typ der Objekte, die vom Cmdlet ausgegeben werden.

  • Microsoft.Containers.PowerShell.Objects.Container

    Microsoft.Containers.PowerShell.Objects.Container

Beispiele

Example 1: Create a container from an existing image

This cmdlet creates a new container called Container01, built from the container image stored in the $Image01 variable.

PS C:\> New-Container -ContainerImage $Image01 -Name "Container01"                        

Example 2: Create a container from an image and specify publisher and version

This command creates a new container from the container image named Image01 from publisher Contoso, version 1.1.0.0.

PS C:\> New-Container -ContainerImageName "Image01" -ContainerImagePublisher "Contoso" -ContainerImageVersion 1.1.0.0                        

Verwandte Themen

Get-Container