ContainerInfo/Get-NavContainerImageName.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<#
 .Synopsis
  Get the name of the image used to run a Nav container
 .Description
  Get the name of the image used to run a Nav container
  The image name can be used to run a new instance of a Nav Container with the same version of Nav
 .Parameter containerName
  Name of the container for which you want to get the image name
 .Example
  $imageName = Get-NavContainerImageName -containerName navserver
  PS C:\>Docker run -e accept_eula=Y $imageName
#>

function Get-NavContainerImageName {
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory=$true)]
        [string]$containerName
    )

    Process {
        $inspect = docker inspect $containerName | ConvertFrom-Json
        return "$($inspect.Config.Image)"
    }
}
Export-ModuleMember -function Get-NavContainerImageName