How to upload a new license in the container

  less than 1 minute read

Recently I ran into a permission error while deploying the app and it is due to licensing, and it is because our development license is expired.

To upload a new license into docker you need to use the following Command

Import-BcContainerLicense -containerName ABC -licenseFile "C:\Temp\License.flf" -restart

Please make sure you add the restart option otherwise the new license will not take effect.

In my case, I have several containers so I need a simple script to find all the container names and pass the container name to the above script.

There may be other ways but below is the script I have used to get all the names of the containers and upload license in every container.


$names = docker ps -asf "name=$($this.name)" --format "{json .}}" | ConvertFrom-Json | Select-Object -expandproperty Names
        

if ($names) {
    foreach ($name in $names) {
        Write-Output $name
        Import-BcContainerLicense -containerName $name -licenseFile 'C:\Users\skulla\OneDrive - ArcherPoint, Inc\Documents\Licenses\APDEV-BC.flf' -restart
        }
    }
        

If you have any other tips or suggestions, please do share them in the comments below.

Leave a comment