-
Notifications
You must be signed in to change notification settings - Fork 237
/
Get-NavContainerArtifactUrl.ps1
29 lines (28 loc) · 1.18 KB
/
Get-NavContainerArtifactUrl.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
28
29
<#
.Synopsis
Get the artifactUrl used to run a NAV/BC Container (or blank if artifacts wasn't used)
.Description
Get the artifactUrl used to run a NAV/BC Container (or blank if artifacts wasn't used)
The artifactUrl can be used to run a new instance of a Container with the same version of NAV/BC
.Parameter containerName
Name of the container for which you want to get the image name
.Example
$artifactUrl = Get-BcContainerArtifactUrl -containerName bcserver
PS C:\>New-BcContainer -accept_eula -artifactUrl $artifactUrl -containerName test
#>
function Get-BcContainerArtifactUrl {
[CmdletBinding()]
Param (
[string] $containerName = $bcContainerHelperConfig.defaultContainerName
)
$inspect = docker inspect $containerName | ConvertFrom-Json
$artifactUrlEnv = $inspect.config.Env | Where-Object { $_ -like "artifactUrl=*" }
if ($artifactUrlEnv) {
return $artifactUrlEnv.SubString("artifactUrl=".Length)
}
else {
return ""
}
}
Set-Alias -Name Get-NavContainerArtifactUrl -Value Get-BcContainerArtifactUrl
Export-ModuleMember -Function Get-BcContainerArtifactUrl -Alias Get-NavContainerArtifactUrl