title: azureml how to deploy docker image to webservice
body: <p>Try to containerize models using docker and use this in a web service. Getting the following error &quot;azureml.exceptions._azureml_exception.WebserviceException: WebserviceException:Message: Models must either be of type azureml.core.Model or a str path to a file or folder&quot;.</p>
  <pre><code>    env = Environment.from_conda_specification(&quot;env&quot;, &quot;../Environments.yml&quot;)
      inf_conf = InferenceConfig(
      entry_script=&quot;score.py&quot;,
      environment=env)
  
  
      docker_image = Model.package(ws, [models_latest], inf_conf)
      docker_image.wait_for_creation(show_output=True) 
  
  
  
      # Deploy the image
      webservice_name = os.environ['WEB_SERVICE_NAME']
  
      retries = 2
      while retries &gt; 0:
          try:
              service = AciWebservice(workspace = ws,
                                      name = webservice_name)
              service.update(image = docker_image)
              print('Webservice updated')   
          except:
              print('Webservice not found')
              service = Webservice.deploy_from_image(workspace = ws,
                                                  name = webservice_name,
                                                  image = docker_image,
                                                  deployment_config = aciconfig)
  
          # wait for deployment, get logs if failed
          try:
              service.wait_for_deployment(show_output = True)
              break
          except:
              print(service.get_logs())
              retries -= 1
              if retries == 0:
                  raise
  </code></pre>