【发布时间】:2022-09-23 18:01:53
【问题描述】:
我正在遵循tutorial 中的步骤。我在执行此 CLI 命令时遇到问题:
az container create \\
--name docks \\
--resource-group MyResourceGroup \\
--ip-address Public \\
--image jenkins/inbound-agent:latest \\
--os-type linux \\
--ports 80 \\
--command-line \"jenkins-agent -url http://jenkinsServer:8080 secret agentName\"
它提供以下输出:
{
\"containers\": [
{
\"command\": [
\"jenkins-agent\",
\"-url\",
\"http://jenkinsServer:8080\",
\"secret\",
\"agentName\"
],
\"environmentVariables\": [],
\"image\": \"jenkins/inbound-agent:latest\",
\"instanceView\": {
\"currentState\": {
\"detailStatus\": \"CrashLoopBackOff: Back-off restarting failed\",
\"exitCode\": null,
\"finishTime\": null,
\"startTime\": null,
\"state\": \"Waiting\"
},
\"events\": [
{
\"count\": 1,
\"firstTimestamp\": \"2022-09-07T16:57:57+00:00\",
\"lastTimestamp\": \"2022-09-07T16:57:57+00:00\",
\"message\": \"pulling image \\\"jenkins/inbound-agent@sha256:f495769bfc767bc77f6c2f8268a734dbac98249449f139f95fc434eb26c6489a\\\"\",
\"name\": \"Pulling\",
\"type\": \"Normal\"
},
{
\"count\": 1,
\"firstTimestamp\": \"2022-09-07T16:59:00+00:00\",
\"lastTimestamp\": \"2022-09-07T16:59:00+00:00\",
\"message\": \"Successfully pulled image \\\"jenkins/inbound-agent@sha256:f495769bfc767bc77f6c2f8268a734dbac98249449f139f95fc434eb26c6489a\\\"\",
\"name\": \"Pulled\",
\"type\": \"Normal\"
},
{
\"count\": 2,
\"firstTimestamp\": \"2022-09-07T16:59:57+00:00\",
\"lastTimestamp\": \"2022-09-07T17:00:18+00:00\",
\"message\": \"Started container\",
\"name\": \"Started\",
\"type\": \"Normal\"
},
{
\"count\": 1,
\"firstTimestamp\": \"2022-09-07T17:00:08+00:00\",
\"lastTimestamp\": \"2022-09-07T17:00:08+00:00\",
\"message\": \"Killing container with id XXXXXXXXXXXXXXXXXXXXXXX.\",
\"name\": \"Killing\",
\"type\": \"Normal\"
}
],
\"previousState\": {
\"detailStatus\": \"Error\",
\"exitCode\": 255,
\"finishTime\": \"2022-09-07T17:00:29.169000+00:00\",
\"startTime\": \"2022-09-07T17:00:18.785000+00:00\",
\"state\": \"Terminated\"
},
\"restartCount\": 1
},
\"livenessProbe\": null,
\"name\": \"docks\",
\"ports\": [
{
\"port\": 80,
\"protocol\": \"TCP\"
}
],
\"readinessProbe\": null,
\"resources\": {
\"limits\": null,
\"requests\": {
\"cpu\": 1.0,
\"gpu\": null,
\"memoryInGb\": 1.5
}
},
\"volumeMounts\": null
}
],
\"diagnostics\": null,
\"dnsConfig\": null,
\"encryptionProperties\": null,
\"id\": \"/subscriptions/azureSub/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerInstance/containerGroups/docks\",
\"identity\": null,
\"imageRegistryCredentials\": null,
\"initContainers\": [],
\"instanceView\": {
\"events\": [],
\"state\": \"Running\"
},
\"ipAddress\": {
\"dnsNameLabel\": null,
\"fqdn\": null,
\"ip\": \"XX.XXX.XXX.XX\",
\"ports\": [
{
\"port\": 80,
\"protocol\": \"TCP\"
}
],
\"type\": \"Public\"
},
\"location\": \"westeurope\",
\"name\": \"docks\",
\"osType\": \"Linux\",
\"provisioningState\": \"Succeeded\",
\"resourceGroup\": \"MyResourceGroup\",
\"restartPolicy\": \"Always\",
\"sku\": \"Standard\",
\"subnetIds\": null,
\"tags\": {},
\"type\": \"Microsoft.ContainerInstance/containerGroups\",
\"volumes\": null,
\"zones\": null
}
如您所见,它给出了 255 错误,但是我还没有找到与它相关的任何内容。
我还尝试将--command-line 更改为:
java -jar agent.jar -jnlpUrl http://jenkinsServer:8080 secret agentName
但是会发生相同的输出。 这会创建容器,但它会无限期地重新启动(启动和失败)。
Jenkins 服务器位于遵循此 tutorial 的 Linux VM 中
如何使 VM 中的 Jenkins 代理在使用 Azure 的 docker 容器映像中运行?
标签: azure jenkins command-line-interface azure-container-instances