我试图为一个简单的Windows从属创建一个docker模板,该模板必须与使用Linux从属映像的已定义模板一起工作。但是,我遇到以下错误:
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)
该架构的简要说明:
集群在Docker Swarm 18.09.1上运行,节点组成为:
詹金斯版本为2.150.2
config.xml 中的“云”部分:
<com.github.kostyasha.yad.DockerCloud plugin="yet-another-docker-plugin@0.1.1">
<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>
我正在使用的多操作系统docker群是使用特定于平台的标签配置的(请参阅此线程的最后评论以供参考)。波纹管是Windows工作程序节点配置的相关子集:
"Description": {
"Hostname": "myHostname",
"Platform": {
"Architecture": "x86_64",
"OS": "windows"
}
此外,我已经成功将slave作为服务部署,并看到将其分派到正确的机器上。该服务的配置如下:
version: '3.3'
services:
windows-example:
image: mydtr.com/slave_node:windows-jnlp
deploy:
replicas: 1
placement:
constraints: [node.platform.os == windows]
任何帮助将不胜感激。