dotnet-architecture / eShopOnContainers

Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor. Moved to https://github.com/dotnet/eShop.
https://dot.net/architecture
24.52k stars 10.34k forks source link

Error: image operating system "linux" cannot be used on this platform #995

Closed devinvisible closed 5 years ago

devinvisible commented 5 years ago

I'm trying to follow the instructions on the following wiki page but am running into problems: https://github.com/dotnet-architecture/eShopOnContainers/wiki/08.-Setting-up-and-Deploying-eShopOnContainers-to-Windows-Containers

Here's my environment

PS C:\code\eShopOnContainers> docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 131
Server Version: 18.09.2
Storage Driver: windowsfilter
 Windows:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: ics l2bridge l2tunnel nat null overlay transparent
 Log: awslogs etwlogs fluentd gelf json-file local logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 17134 (17134.1.amd64fre.rs4_release.180410-1804)
Operating System: Windows 10 Pro Version 1803 (OS Build 17134.648)
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 16GiB
ID: QDAA:6XNO:XBH2:26J2:4U5L:NPIL:637H:RUYJ:CSVV:QZDV:YUIL:6CRV
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: -1
 Goroutines: 26
 System Time: 2019-04-04T14:02:39.7483571-04:00
 EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

Following the deployment instructions, I ran docker-compose -f docker-compose.yml -f docker-compose.windows.yml build first, which completed without error. I then cd cli-windows and ran .\start-windows-containers.ps1 which worked for a while before showing the following message:

Pulling seq (datalust/seq:latest)...
latest: Pulling from datalust/seq
ERROR: image operating system "linux" cannot be used on this platform

Docker is setup for windows containers so this message confused me. The instructions mentioned that the powershell script sets up some environment and runs a docker-compose up command under the hood so I tried running that by hand and received the same result:

PS C:\code\eShopOnContainers> docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.windows.yml -f docker-compose.override.windows.yml up
WARNING: The INSTRUMENTATION_KEY variable is not set. Defaulting to a blank string.
WARNING: The ORCHESTRATOR_TYPE variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_SERVICE_BUS_USERNAME variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_SERVICE_BUS_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_AZURE_STORAGE_CATALOG_NAME variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_AZURE_STORAGE_CATALOG_KEY variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_AZURE_STORAGE_MARKETING_NAME variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_AZURE_STORAGE_MARKETING_KEY variable is not set. Defaulting to a blank string.
Pulling seq (datalust/seq:latest)...
latest: Pulling from datalust/seq
ERROR: image operating system "linux" cannot be used on this platform

I recalled seeing "seq" mentioned during the build command. I re-ran docker-compose build using the same arguments I used with docker-compose up (which is more than what the wiki instructions suggestions... which btw, have an extra, erroneous -f``):docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.windows.yml -f docker-compose.override.windows.yml build`

The "seq" line seen is:

seq uses an image, skipping

The docker-compose build output constantly states that images are being tagged ending with ":linux-latest" which seems suspicious.

I'm not sure what I'm missing. My understanding is that this should have just stood up and worked. What might I be missing?

devinvisible commented 5 years ago

After a little more effort, the docker-compose.windows.yml file probably needs the following:

services:
  seq:
    image: datalust/seq-windows:4.1.17

My suspicion is that this wouldn't have been a problem if the docker host was on a linux os.

mvelosop commented 5 years ago

Hi @devinvisible, you're right, this just works when using Linux containers!

There's quite few people that use Windows containers, so there are times when Windows containers are a bit behind.

I'll begin checking on this.

devinvisible commented 5 years ago

Thank you. I can confirm that what I suggested above will lead to a successful build. However, I'm running into another issue which I've yet to resolve:

PS C:\code\eShopOnContainers\cli-windows> .\start-windows-containers.ps1
Root path used is C:\code\eShopOnContainers\cli-windows\..
WARNING: The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP variable is not set. Defaulting to a blank string.
WARNING: The INSTRUMENTATION_KEY variable is not set. Defaulting to a blank string.
WARNING: The ORCHESTRATOR_TYPE variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_SERVICE_BUS_USERNAME variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_SERVICE_BUS_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_AZURE_STORAGE_CATALOG_NAME variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_AZURE_STORAGE_CATALOG_KEY variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_AZURE_STORAGE_MARKETING_NAME variable is not set. Defaulting to a blank string.
WARNING: The ESHOP_AZURE_STORAGE_MARKETING_KEY variable is not set. Defaulting to a blank string.
eshoponcontainers_seq_1 is up-to-date
Starting eshoponcontainers_sql.data_1 ...
eshoponcontainers_webspa_1 is up-to-date
eshoponcontainers_webstatus_1 is up-to-date
eshoponcontainers_rabbitmq_1 is up-to-date
Starting eshoponcontainers_sql.data_1    ... error
Starting eshoponcontainers_nosql.data_1 ...
Starting eshoponcontainers_payment.api_1 ...
Starting eshoponcontainers_nosql.data_1  ... error
ERROR: for eshoponcontainers_sql.data_1  Cannot start service sql.data: The requested compute system operation is not valid in the current state.

Starting eshoponcontainers_payment.api_1 ... done

ERROR: for sql.data  Cannot start service sql.data: The requested compute system operation is not valid in the current state.

ERROR: for nosql.data  Cannot start service nosql.data: The requested compute system operation is not valid in the current state.
ERROR: Encountered errors while bringing up the project.
devinvisible commented 5 years ago

Restarting my host resolved that issue but I ran into yet another issue and I'm over this. I'm going to abandon trying to get this setup in windows containers and closing this issue.

ERROR: for eshoponcontainers_identity.api_1  Cannot start service identity.api: container 670a47dc93cc7776b5688db6768dca1defca9e8df67049dcf3b51f9083996069 encountered an error during CreateProcess: failure in a Windows system call: The group or resource is not in the correct state to perform the requested operation. (0x139f)
[Event Detail: Transport Error Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\common\bridge\bridgerelay.cpp(187)\vmcomputeagent.exe!00007FF653E40F42: (caller: 00007FF653DBB8F3) Exception(4) tid(364) 8007139F The group or resource is not in the correct state to perform the requested operation.
    Msg:[Transport Error] CallContext:[\Bridge_ProcessMessage\ComputeSystemManager_ExecuteProcess\VmHostedContainer_ExecuteProcess]
 Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"dotnet Identity.API.dll","User":"ContainerUser","WorkingDirectory":"C:\\app","Environment":{"ASPNETCORE_ENVIRONMENT":"Development","ASPNETCORE_URLS":"http://0.0.0.0:80","ApplicationInsights__InstrumentationKey":"","BasketApiClient":"http://10.0.75.1:5103","ConnectionString":"Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word","DOTNET_RUNNING_IN_CONTAINER":"true","LocationApiClient":"http://10.0.75.1:5109","MarketingApiClient":"http://10.0.75.1:5110","MobileShoppingAggClient":"http://10.0.75.1:5120","MvcClient":"http://10.0.75.1:5100","OrchestratorType":"","OrderingApiClient":"http://10.0.75.1:5102","SpaClient":"http://10.0.75.1:5104","UseCustomizationData":"True","WebShoppingAggClient":"http://10.0.75.1:5121","WebhooksApiClient":"http://10.0.75.1:5113","WebhooksWebClient":"http://10.0.75.1:5114","XamarinCallback":"http://:5105/xamarincallback"},"CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"Console
mvelosop commented 5 years ago

If it works for you, and taking advantage from .NET Core, it'd probably be better to use Linux containers as it's a MUCH faster build time and it's the version that gets most attention by far.

Last time I built for Windows containers it took more that 1:30 hours to build, while for Linux containers it takes ~20 min in my machine.

Hope this helps.