Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

Unable to create Windows container instance #15938

Closed asparrowhawk closed 1 year ago

asparrowhawk commented 3 years ago

Az container create of windows container image

Failure to create Windows based container

Attempting to run a Windows based container using Azure Container Instance.

Built the container image locally using Windows server 2019 and docker Pushed built image to new empty Azure container registry Attempted to create running container.

Command Name az container create --name aci-mqtt-test --image sparrowhawkaciregistry.azurecr.io/mqttnet-server:3.0.13 --cpu 1 --memory 4 --registry-login-server sparrowhawkaciregistry.azurecr.io --registry-username sparrowhawkaciregistry --registry-password abcdefghik --resource-group sparrowhawk-aci-test --os-type Windows --ip-address public --ports 80 1883

Errors:

'Response' object has no attribute 'status'
Traceback (most recent call last):
azure/cli/core/adal_authentication.py, ln 103, in set_token
    super(MSIAuthenticationWrapper, self).set_token()
python3.6/site-packages/msrestazure/azure_active_directory.py, ln 598, in set_token
    self.scheme, _, self.token = get_msi_token(self.resource, self.port, self.msi_conf)
python3.6/site-packages/msrestazure/azure_active_directory.py, ln 486, in get_msi_token
    result.raise_for_status()
...

azure/cli/core/adal_authentication.py, ln 114, in set_token
    .format(err.response.status, err.response.reason))
AttributeError: 'Response' object has no attribute 'status'

To Reproduce:

Used the following Dockerfile to create container locally

Dockerfile:

# escape=`

ARG WINDOWS_VERSION=2019
ARG REPO=mcr.microsoft.com
FROM ${REPO}/dotnet/aspnet:5.0-windowsservercore-ltsc${WINDOWS_VERSION}

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ENV MQTT_VERSION 3.0.13
ENV INSTALL_DIR 'C:\Server'
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls11; `
    New-Item -Type Directory $env:INSTALL_DIR; `
    Invoke-WebRequest -UseBasicParsing https://github.com/chkr1011/MQTTnet/releases/download/v3.0.13/MQTTnet.Server-Windows-x64-v3.0.13.zip -OutFile MQTTnet.Server.zip; `
    Expand-Archive MQTTnet.Server.zip -DestinationPath $env:INSTALL_DIR -Verbose:$False; `
    Remove-Item MQTTnet.Server.zip

EXPOSE 80 1883

WORKDIR ${INSTALL_DIR}

ENTRYPOINT [ "MQTTnet.Server.exe" ]

Tagged built docker container with Azure container registry name Pushed container Verified container present in registry

Expected Behavior

Running container or meaningful diagnostic information

Environment Summary

Linux-4.15.0-1098-azure-x86_64-with-debian-stretch-sid (Cloud Shell)
Python 3.6.10
Installer: DEB

azure-cli 2.14.0 *

Extensions:
ai-examples 0.2.4

Additional Context

Would be useful to have recommended minimum cpu and memory settings for Windows containers. Documentation appears to use 1 cpu and 1 GB of memory and Linux as the O/S.

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dkkapur.

Issue Details
Description: ### Az container create of windows container image ## Failure to create Windows based container Attempting to run a Windows based container using Azure Container Instance. Built the container image locally using Windows server 2019 and docker Pushed built image to new empty Azure container registry Attempted to create running container. **Command Name** `az container create --name aci-mqtt-test --image sparrowhawkaciregistry.azurecr.io/mqttnet-server:3.0.13 --cpu 1 --memory 4 --registry-login-server sparrowhawkaciregistry.azurecr.io --registry-username sparrowhawkaciregistry --registry-password abcdefghik --resource-group sparrowhawk-aci-test --os-type Windows --ip-address public --ports 80 1883` **Errors:** ``` 'Response' object has no attribute 'status' Traceback (most recent call last): azure/cli/core/adal_authentication.py, ln 103, in set_token super(MSIAuthenticationWrapper, self).set_token() python3.6/site-packages/msrestazure/azure_active_directory.py, ln 598, in set_token self.scheme, _, self.token = get_msi_token(self.resource, self.port, self.msi_conf) python3.6/site-packages/msrestazure/azure_active_directory.py, ln 486, in get_msi_token result.raise_for_status() ... azure/cli/core/adal_authentication.py, ln 114, in set_token .format(err.response.status, err.response.reason)) AttributeError: 'Response' object has no attribute 'status' ``` ## To Reproduce: Used the following Dockerfile to create container locally Dockerfile: ``` # escape=` ARG WINDOWS_VERSION=2019 ARG REPO=mcr.microsoft.com FROM ${REPO}/dotnet/aspnet:5.0-windowsservercore-ltsc${WINDOWS_VERSION} SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ENV MQTT_VERSION 3.0.13 ENV INSTALL_DIR 'C:\Server' RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls11; ` New-Item -Type Directory $env:INSTALL_DIR; ` Invoke-WebRequest -UseBasicParsing https://github.com/chkr1011/MQTTnet/releases/download/v3.0.13/MQTTnet.Server-Windows-x64-v3.0.13.zip -OutFile MQTTnet.Server.zip; ` Expand-Archive MQTTnet.Server.zip -DestinationPath $env:INSTALL_DIR -Verbose:$False; ` Remove-Item MQTTnet.Server.zip EXPOSE 80 1883 WORKDIR ${INSTALL_DIR} ENTRYPOINT [ "MQTTnet.Server.exe" ] ``` Tagged built docker container with Azure container registry name Pushed container Verified container present in registry - _Put any pre-requisite steps here..._ - `az container create --name {} --image {} --cpu {} --memory {} --registry-login-server {} --registry-username {} --registry-password {} --resource-group {} --os-type {} --ip-address {} --ports {} {}` ## Expected Behavior Running container or meaningful diagnostic information ## Environment Summary ``` Linux-4.15.0-1098-azure-x86_64-with-debian-stretch-sid (Cloud Shell) Python 3.6.10 Installer: DEB azure-cli 2.14.0 * Extensions: ai-examples 0.2.4 ``` ## Additional Context Would be useful to have recommended minimum cpu and memory settings for Windows containers. Documentation appears to use 1 cpu and 1 GB of memory and Linux as the O/S.
Author: asparrowhawk
Assignees: -
Labels: `Container Instances`, `Service Attention`
Milestone: -

yonzhan commented 3 years ago

container

RakeshMohanMSFT commented 1 year ago

Please upgrade to latest version of 2.43.0 and retry.