Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to launch an ephemeral windows slave - Could not pull image: image operating system "windows" cannot be used on this platform #265

Open
jonasg94 opened this issue Jul 5, 2019 · 0 comments

Comments

@jonasg94
Copy link

jonasg94 commented Jul 5, 2019

I’ve tried to create a docker template for a simple windows-slave that must work along side already defined templates that make use of a linux-slave image(s). However, I am having the following error:

Jul 04, 2019 3:47:09 PM com.github.kostyasha.yad.DockerCloud provision
INFO: Asked to provision load: '1', for: 'JNLP' label
Jul 04, 2019 3:47:09 PM com.github.kostyasha.yad.DockerCloud provision
INFO: Will provision 'mydtr/slave_node:windows-jnlp', for label: 'JNLP', in cloud: 'My Cloud'
Jul 04, 2019 3:47:09 PM com.github.kostyasha.yad.DockerCloud addProvisionedSlave
INFO: Provisioning 'mydtr/slave_node:windows-jnlp' number '0' on 'My Cloud'; Total containers: '0'
Jul 04, 2019 3:47:09 PM com.github.kostyasha.yad.commons.DockerPullImage execInternal
INFO: Pulling image 'mydtr/slave_node:windows-jnlp'. This may take awhile...
Jul 04, 2019 3:47:10 PM com.github.kostyasha.yad.DockerCloud lambda$provision$0
SEVERE: Error in provisioning; template='dockerslavetemplate[configversion=1,maxcapacity=10,id=xxxxxxxxx,labelstring=jnlp,launcher=com.github.kostyasha.yad.launcher.dockercomputerjnlplauncher@61614138[launchtimeout=120,user=,jvmopts=,slaveopts=,jenkinsurl=,nocertificatecheck=false,reconnect=false,launcher=<null>],remotefs=/,mode=exclusive,retentionstrategy=com.github.kostyasha.yad.strategy.dockeronceretentionstrategy@1fbbf3d7],connector=<null>],createContainer=DockerCreateContainer[command=,commands=<null>,entrypoint=<null>,hostname=,dnsHosts=[],volumes=[\\.\\pipe\\docker_engine:\\.\\pipe\\docker_engine],volumesFrom=[],environment=[constraint:node.platform.os==windows],bindPorts=,bindAllPorts=false,memoryLimit=0,cpuShares=<null>,privileged=false,tty=false,macAddress=<null>,extraHosts=[],networkMode=<null>,devices=[],cpusetCpus=,cpusetMems=,links=[],dockerLabels=[],shmSize=0,restartPolicy=DockerContainerRestartPolicy[policyName=NO,maximumRetryCount=0],workdir=,user=],stopContainer=DockerStopContainer[timeout=10,connector=<null>],removeContainer=DockerRemoveContainer[removeVolumes=false,force=false,connector=<null>]],nodeProperties=<null>]' for cloud='My Cloud'
com.github.kostyasha.yad_docker_java.com.github.dockerjava.api.exception.DockerClientException: Could not pull image: image operating system "windows" cannot be used on this platform
at com.github.kostyasha.yad_docker_java.com.github.dockerjava.core.command.PullImageResultCallback.checkDockerClientPullSuccessful(PullImageResultCallback.java:96)
at com.github.kostyasha.yad_docker_java.com.github.dockerjava.core.command.PullImageResultCallback.throwFirstError(PullImageResultCallback.java:111)
at com.github.kostyasha.yad_docker_java.com.github.dockerjava.core.async.ResultCallbackTemplate.awaitCompletion(ResultCallbackTemplate.java:94)
at com.github.kostyasha.yad_docker_java.com.github.dockerjava.core.command.PullImageResultCallback.awaitSuccess(PullImageResultCallback.java:124)
at com.github.kostyasha.yad.commons.DockerPullImage.execInternal(DockerPullImage.java:166)
at com.github.kostyasha.yad.commons.DockerPullImage.exec(DockerPullImage.java:125)
at com.github.kostyasha.yad.DockerCloud.provisionWithWait(DockerCloud.java:229)
at com.github.kostyasha.yad.DockerCloud.lambda$provision$0(DockerCloud.java:135)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:7)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Brief description of the architecture:

The cluster is running on Docker Swarm 18.09.1 and the node composition is:

  • 3 Linux managers
  • 1 Linux Worker
  • 1 Windows Worker

The jenkins version is 2.150.2
Cloud section from config.xml:

<com.github.kostyasha.yad.DockerCloud plugin="[email protected]">
   <name>My Cloud</name>
   <provisionedImages/>
   <templates>
     <com.github.kostyasha.yad.DockerSlaveTemplate>
       <id>xxxxxxxxxx</id>
       <labelString>JNLP</labelString>
       <launcher class="com.github.kostyasha.yad.launcher.DockerComputerJNLPLauncher">
         <launchTimeout>120</launchTimeout>
         <user></user>
         <jvmOpts></jvmOpts>
         <slaveOpts></slaveOpts>
         <jenkinsUrl></jenkinsUrl>
         <noCertificateCheck>false</noCertificateCheck>
         <reconnect>false</reconnect>
       </launcher>
       <remoteFs>/</remoteFs>
       <mode>EXCLUSIVE</mode>
       <retentionStrategy class="com.github.kostyasha.yad.strategy.DockerOnceRetentionStrategy">
         <idleMinutes>10</idleMinutes>
         <idleMinutes defined-in="com.github.kostyasha.yad.strategy.DockerOnceRetentionStrategy">10</idleMinutes>
       </retentionStrategy>
       <numExecutors>1</numExecutors>
       <dockerContainerLifecycle>
         <image>mydtr/slave_node:windows-jnlp</image>
         <pullImage>
           <pullStrategy>PULL_ALWAYS</pullStrategy>
           <credentialsId>XXXXXXXXXXXXXX</credentialsId>
           <registriesCreds>
             <com.github.kostyasha.yad.commons.DockerRegistryCredential>
               <registryAddr>https://mydtr.com/</registryAddr>
               <credentialsId>XXXXXXXXXXXXX</credentialsId>
             </com.github.kostyasha.yad.commons.DockerRegistryCredential>
           </registriesCreds>
         </pullImage>
         <createContainer>
           <command></command>
           <hostname></hostname>
           <dnsHosts class="java.util.Collections$UnmodifiableRandomAccessList" resolves-to="java.util.Collections$UnmodifiableList">
             <c class="list"/>
             <list reference="../c"/>
           </dnsHosts>
           <volumes class="java.util.Collections$UnmodifiableRandomAccessList" resolves-to="java.util.Collections$UnmodifiableList">
             <c class="list">
               <string>\\.\\pipe\\docker_engine:\\.\\pipe\\docker_engine</string>
             </c>
             <list reference="../c"/>
           </volumes>
           <volumesFrom class="java.util.Collections$UnmodifiableRandomAccessList" resolves-to="java.util.Collections$UnmodifiableList">
             <c class="list"/>
             <list reference="../c"/>
           </volumesFrom>
           <environment class="java.util.Collections$UnmodifiableRandomAccessList" resolves-to="java.util.Collections$UnmodifiableList">
             <c class="list">
               <string>constraint:node.platform.os==windows</string>
             </c>
             <list reference="../c"/>
           </environment>
           <bindPorts></bindPorts>
           <bindAllPorts>false</bindAllPorts>
           <memoryLimit>0</memoryLimit>
           <privileged>false</privileged>
           <tty>false</tty>
           <extraHosts class="java.util.Collections$UnmodifiableRandomAccessList" resolves-to="java.util.Collections$UnmodifiableList">
             <c class="list"/>
             <list reference="../c"/>
           </extraHosts>
           <devices class="java.util.Collections$UnmodifiableRandomAccessList" resolves-to="java.util.Collections$UnmodifiableList">
             <c class="list"/>
             <list reference="../c"/>
           </devices>
           <cpusetCpus></cpusetCpus>
           <cpusetMems></cpusetMems>
           <links class="java.util.Collections$UnmodifiableRandomAccessList" resolves-to="java.util.Collections$UnmodifiableList">
             <c class="list"/>
             <list reference="../c"/>
           </links>
           <dockerLabels class="java.util.Collections$UnmodifiableRandomAccessList" resolves-to="java.util.Collections$UnmodifiableList">
             <c class="list"/>
             <list reference="../c"/>
           </dockerLabels>
           <shmSize>0</shmSize>
           <restartPolicy>
             <policyName>NO</policyName>
             <maximumRetryCount>0</maximumRetryCount>
           </restartPolicy>
           <workdir></workdir>
           <user></user>
         </createContainer>
         <stopContainer>
           <timeout>10</timeout>
         </stopContainer>
         <removeContainer>
           <removeVolumes>false</removeVolumes>
           <force>false</force>
         </removeContainer>
       </dockerContainerLifecycle>
       <configVersion>1</configVersion>
       <maxCapacity>10</maxCapacity>
     </com.github.kostyasha.yad.DockerSlaveTemplate>
   </templates>
   <containerCap>50</containerCap>
   <connector>
     <serverUrl>unix:///var/run/docker.sock</serverUrl>
     <apiVersion>1.39</apiVersion>
     <credentialsId></credentialsId>
     <connectorType>JERSEY</connectorType>
   </connector>
 </com.github.kostyasha.yad.DockerCloud>

The multi-os docker swarm that I’m working on is configured using platform specific labels (see last comment of this thread for reference). Bellow is the relevant subset of the windows worker node’s configuration:

    "Description": {
        "Hostname": "myHostname",
        "Platform": {
            "Architecture": "x86_64",
            "OS": "windows"
        }

Additionally, I have successfully deployed the slave as a service and saw it being dispatched to the correct machine. The service’s configuration is as follows:

version: '3.3'
services:
  windows-example:
    image: mydtr.com/slave_node:windows-jnlp
    deploy:
      replicas: 1
      placement:
        constraints: [node.platform.os == windows]

Any help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant