diff --git a/docker/Dockerfile-centos-7 b/docker/Dockerfile-centos-7 index 58a35c4f..70a2d8dd 100644 --- a/docker/Dockerfile-centos-7 +++ b/docker/Dockerfile-centos-7 @@ -7,9 +7,9 @@ ARG AZURERM_CONTEXT_SETTINGS=AzureRmContextSettings.json ARG AZURE=/root/.Azure ARG VCS_REF="none" ARG BUILD_DATE= -ARG VERSION=0.10.0 +ARG VERSION=1.10.0 ARG IMAGE_NAME=mcr.microsoft.com/azure-stack-powershell:${VERSION}-centos-7 -ARG AZURESTACK_PROFILE=2019-03-01-hybrid +ARG AZURESTACK_PROFILE=2020-09-01-hybrid ARG AZURESTACK_VERSION=2.1.0 ARG READINESS_CHECKER_VERSION=1.2005.1269-preview diff --git a/docker/Dockerfile-debian-9 b/docker/Dockerfile-debian-9 index 269b1a66..d64dd249 100644 --- a/docker/Dockerfile-debian-9 +++ b/docker/Dockerfile-debian-9 @@ -7,9 +7,9 @@ ARG AZURERM_CONTEXT_SETTINGS=AzureRmContextSettings.json ARG AZURE=/root/.Azure ARG VCS_REF="none" ARG BUILD_DATE= -ARG VERSION=0.10.0 +ARG VERSION=1.10.0 ARG IMAGE_NAME=mcr.microsoft.com/azure-stack-powershell:${VERSION}-debian-9 -ARG AZURESTACK_PROFILE=2019-03-01-hybrid +ARG AZURESTACK_PROFILE=2020-09-01-hybrid ARG AZURESTACK_VERSION=2.1.0 ARG READINESS_CHECKER_VERSION=1.2005.1269-preview diff --git a/docker/Dockerfile-ubuntu-18.04 b/docker/Dockerfile-ubuntu-18.04 index 535216f4..72fda8ca 100644 --- a/docker/Dockerfile-ubuntu-18.04 +++ b/docker/Dockerfile-ubuntu-18.04 @@ -7,9 +7,9 @@ ARG AZURERM_CONTEXT_SETTINGS=AzureRmContextSettings.json ARG AZURE=/root/.Azure ARG VCS_REF="none" ARG BUILD_DATE= -ARG VERSION=0.10.0 +ARG VERSION=1.10.0 ARG IMAGE_NAME=mcr.microsoft.com/azure-stack-powershell:${VERSION}-ubuntu-18.04 -ARG AZURESTACK_PROFILE=2019-03-01-hybrid +ARG AZURESTACK_PROFILE=2020-09-01-hybrid ARG AZURESTACK_VERSION=2.1.0 ARG READINESS_CHECKER_VERSION=1.2005.1269-preview diff --git a/docker/README.md b/docker/README.md index 6a3c03f0..1996560b 100644 --- a/docker/README.md +++ b/docker/README.md @@ -22,6 +22,26 @@ The release containers derive from the [Powershell image][powershell image], and AzureStack PowerShell [release notes](https://aka.ms/azspsdocker) +## Building the images + +Using `Dockerfile-ubuntu-18.04` as an example, here is the command to build the docker file and at the same time tagging it `mcr.microsoft.com/powershell:ubuntu-18.04`: + +```sh +docker build -f .\Dockerfile-ubuntu-18.04 -t mcr.microsoft.com/powershell:ubuntu-18.04 . +``` + +Tagging images is useful for organizing your images. It is currently not possible to tag docker images within a dockerfile, so you will have to tag your image manually after its creation: + +```sh +docker tag mcr.microsoft.com/powershell:ubuntu-18.04 +``` + +`WARNING`: docker builds seem to break very easily. If it fails at first, try a clean build it several times. The `--no-cache` option ensures a build that doesn't use cached steps: + +```sh +docker build -f .\Dockerfile-debian-9 -t mcr.microsoft.com/powershell:ubuntu-18.04 . --no-cache +``` + ## Examples ### Download/Update the AzureStack Powershell image @@ -34,19 +54,19 @@ docker pull mcr.microsoft.com/azurestack/powershell: ### Run AzureStack Powershell container -- To run AzureStack Powershell in a container in an interactive mode: +- To run a new container with AzureStack resources from a docker image with Powershell Core as the interactive command interface: ```sh $ docker run -it mcr.microsoft.com/azurestack/powershell:0.1.0-ubuntu-18.04 pwsh ``` -- To run AzureStack Powershell in a container: +- To start an existing container containing AzureStack resources with Powershell Core as the interactive command interface: ```sh $ docker start -ia mcr.microsoft.com/azurestack/powershell:0.1.0-ubuntu-18.04 pwsh ``` -- To run AzureStack Powershell from using a container in an interactive mode using host authentication: +- To run a container containing AzureStack resources from a docker image in an interactive Powershell Core interface using host authentication: 1. Make sure that `$HOME/.Azure` is present on the host (default location). 2. You may need to grant access this location for the docker process. @@ -64,7 +84,7 @@ docker run -it --rm -v ~/.Azure/AzureRmContext.json:/root/.Azure/AzureRmContext. ### Remove image ```sh -docker rmi mcr.microsoft.com/azurestack/powershell +docker rmi ``` ### Testing @@ -81,18 +101,18 @@ docker run Login using credentials: ```sh ./Login-Environment.ps1 -[-Name ] # Defaults to 'AzureStack' +[-EnvironmentName ] # Defaults to 'AzureStack' -ResourceManagerEndpoint --DirectoryTenantId +-TenantId -Credential [-SubscriptionId ] ``` Login using certificates: ```sh ./Login-Environment.ps1 -[-Name ] # Defaults to 'AzureStack' +[-EnvironmentName ] # Defaults to 'AzureStack' -ResourceManagerEndpoint --DirectoryTenantId +-TenantId -ApplicationId -CertificateThumbprint [-SubscriptionId ] @@ -110,7 +130,7 @@ Login using certificates: ```sh ./Test-AzsPowershell.ps1 [-ClientObjectId ] # Defaults to $ENV:ClientObjectId -[-resourceLocation ] # Defaults to $ENV:Location +[-Location ] # Defaults to $ENV:Location ``` ## Developing and Contributing diff --git a/docker/scripts/Test-AzsPowershell.ps1 b/docker/scripts/Test-AzsPowershell.ps1 index 6128e5a4..7029785b 100644 --- a/docker/scripts/Test-AzsPowershell.ps1 +++ b/docker/scripts/Test-AzsPowershell.ps1 @@ -11,7 +11,7 @@ param ( $ClientObjectId = $ENV:ClientObjectId, [Parameter(HelpMessage = "The location of the resources for Azure Stack.")] [string] - $resourceLocation = $ENV:Location + $Location = $ENV:Location ) $resourceGroup = "azurestack-container-rg" @@ -109,7 +109,7 @@ $TestAzKeyVault = { $KeyVaultName = "azurestackContainerKV" Log -Message "Creating new key vault... (New-AzKeyVault)" - New-AzKeyVault -VaultName $KeyVaultName -ResourceGroupName $resourceGroup -Location $resourceLocation -Verbose -ErrorAction Stop + New-AzKeyVault -VaultName $KeyVaultName -ResourceGroupName $resourceGroup -Location $Location -Verbose -ErrorAction Stop Get-AzKeyVault -VaultName $KeyVaultName -ErrorAction Stop Set-AzKeyVaultAccessPolicy -VaultName $KeyVaultName -ResourceGroupName $resourceGroup -ObjectId $ClientObjectId -BypassObjectIdValidation -PermissionsToKeys all -PermissionsToSecrets all -ErrorAction Stop @@ -171,7 +171,7 @@ $TestAzNetwork = { $networkSecurityGroup = "network-sg" Log -Message "Running New-AzNetworkSecurityGroup..." - New-AzNetworkSecurityGroup -ResourceGroupName $resourceGroup -Name $networkSecurityGroup -Location $resourceLocation + New-AzNetworkSecurityGroup -ResourceGroupName $resourceGroup -Name $networkSecurityGroup -Location $Location Log -Message "Running Get-AzNetworkSecurityGroup..." Get-AzNetworkSecurityGroup -ResourceGroupName $resourceGroup -Name $networkSecurityGroup | Format-Table -AutoSize | Out-String | Log Log -Message "Running Remove-AzNetworkSecurityGroup..." @@ -190,7 +190,7 @@ $TestAzWebsites = Log -Message "Running New-AzAppServicePlan..." New-AzAppServicePlan -ResourceGroupName $resourceGroup ` -Name $appName ` - -Location $resourceLocation ` + -Location $Location ` -Tier "Free" ` -NumberofWorkers 1 ` -WorkerSize "Small" | Format-Table -AutoSize | Out-String | Log