Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pull and Run a Linux docker image on an azure pipeline

Tags:

When pulling and running a Linux docker based image in AZURE PIPELINE, I get this error: "image operating system "Linux" cannot be used on this platform"

  1. I create a Linux docker image
  2. I pushed the image to azure registry
  3. I setup the azure pipeline as follow:
    • Docker CLI
    • Azure CLI:
    • I login to registry
    • Command Line:
    • I do: docker pull image
    • I do: docker run -it image

Image showing Azure Pipeline

When I run the pipeline, I get this error: "image operating system "Linux" cannot be used on this platform"

Script output:

2019-03-25T21:23:03.4513990Z ##[section]Starting: Command Line Script
2019-03-25T21:23:03.4616971Z ==============================================================================
2019-03-25T21:23:03.4617284Z Task         : Command Line
2019-03-25T21:23:03.4617442Z Description  : Run a command line script using cmd.exe on Windows and bash on macOS and Linux.
2019-03-25T21:23:03.4617592Z Version      : 2.146.1
2019-03-25T21:23:03.4617715Z Author       : Microsoft Corporation
2019-03-25T21:23:03.4618046Z ==============================================================================
2019-03-25T21:23:04.8241638Z Generating script.
2019-03-25T21:23:04.9020040Z ##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\157d3a61-fe5f-46b2-b74e-1082d4532014.cmd""
2019-03-25T21:23:05.7814076Z v1: Pulling from hubb-api-tests
2019-03-25T21:23:06.2370457Z image operating system "linux" cannot be used on this platform
2019-03-25T21:23:06.2872386Z the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'
2019-03-25T21:23:06.3934386Z ##[error]Cmd.exe exited with code '1'.
2019-03-25T21:23:06.4549404Z ##[section]Finishing: Command Line Script

I expect to be able to pull the image and run it on Azure DevOps pipeline since I tested the same steps on my local computer with no problems.

Thank you so very much

Image showing script output with error

like image 796
Aziz Avatar asked Mar 26 '19 01:03

Aziz


People also ask

How do I build a Docker image in Azure pipeline?

From the Configure tab, select the Docker - Build and push an image to Azure Container Registry task. Select your Azure Subscription, and then select Continue. Select your Container registry from the dropdown menu, and then provide an Image Name to your container image. Select Validate and configure when you are done.

How do I run Docker compose in Azure pipeline?

(Required) Select a Docker Compose action. (Required) Name of the specific service to run. (Optional) Name of the specific service container to run. (Optional) Ports in the specific service container to publish to the host.


1 Answers

You can only achieve this using your own windows agent configured to allow to run linux containers on windows. hosted agents wont allow that.

like image 189
4c74356b41 Avatar answered Oct 19 '22 17:10

4c74356b41