docker AWS Fargate Windows Container无法启动,原因是:“用户名或密码不正确,:未知”

bqucvtff  于 2023-03-29  发布在  Docker
关注(0)|答案(2)|浏览(175)

我试图在Fargate上运行准系统Windows服务器核心ltsc2019,但我得到了以下错误。我已经测试了同一图像的多个变体,但它们似乎都失败了,出现了相同的错误。
我还尝试将操作系统平台设置为“WINDOWS_SERVER_2019_FULL”和“WINDOWS_SERVER_2019_CORE”,但这也没有什么区别。

Stopped | CannotStartContainerError: CannotStartContainerError: hcs::System::CreateProcess: C:\ServiceMonitor.exe w3svc 69da9324ad914d8dbb35bdd2e91bd132-690230031: The user name or password is incorrect.: unknown

任务定义:

{
"taskDefinitionArn": "arn:aws:ecs:eu-west-1:347454123191:task-definition/TH-TeamCity-WIN-Agents-TCLXAgentTaskDefinition-vfqY9KUS25jX:1",
"containerDefinitions": [
    {
        "name": "teamcity-agent",
        "image": "mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019",
        "cpu": 0,
        "links": [],
        "portMappings": [],
        "essential": true,
        "entryPoint": [],
        "command": [],
        "environment": [],
        "environmentFiles": [],
        "mountPoints": [],
        "volumesFrom": [],
        "secrets": [],
        "user": "root",
        "dnsServers": [],
        "dnsSearchDomains": [],
        "extraHosts": [],
        "dockerSecurityOptions": [],
        "dockerLabels": {},
        "ulimits": [],
        "logConfiguration": {
            "logDriver": "awslogs",
            "options": {
                "awslogs-group": "TH-TeamCity-WIN-Agents-ECSLogGroup-QRfQsjAva3sk",
                "awslogs-region": "eu-west-1",
                "awslogs-stream-prefix": "aws/ecs/teamcity-agent"
            },
            "secretOptions": []
        },
        "systemControls": []
    }
],
"family": "TH-TeamCity-WIN-Agents-TCLXAgentTaskDefinition-vfqY9KUS25jX",
"executionRoleArn": "redacted",
"networkMode": "awsvpc",
"revision": 1,
"volumes": [],
"status": "ACTIVE",
"requiresAttributes": [
    {
        "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
    },
    {
        "name": "ecs.capability.execution-role-awslogs"
    },
    {
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
    },
    {
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.17"
    },
    {
        "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
    },
    {
        "name": "ecs.capability.task-eni"
    }
],
"placementConstraints": [],
"compatibilities": [
    "EC2",
    "FARGATE"
],
"requiresCompatibilities": [
    "FARGATE"
],
"cpu": "4096",
"memory": "8192",
"runtimePlatform": {
    "operatingSystemFamily": "WINDOWS_SERVER_2019_FULL"
},
"registeredAt": "2022-07-21T12:08:08.292Z",
"registeredBy": "redacted",
"tags": [
]

}

zwghvu4y

zwghvu4y1#

其中一个原因可能是必须传递给容器的环境变量。你能检查docker镜像需要哪些变量来运行镜像吗?你可以在任务定义中传递变量。谢谢。

dxpyg8gm

dxpyg8gm2#

这是因为图像没有名为root的用户,而任务定义要求用户root。我刚才遇到了同样的问题。删除user设置解决了这个问题。

{
  "taskDefinitionArn": "arn:aws:ecs:eu-west-1:347454123191:task-definition/TH-TeamCity-WIN-Agents-TCLXAgentTaskDefinition-vfqY9KUS25jX:1",
  "containerDefinitions": [
    {
        // ...
        "user": "root", // remove this
    }
  ]
}

您可能可以使用类似下面的内容创建用户,但我还没有尝试过。

RUN New-LocalUser -Name "root" -NoPassword

相关问题