无法将 docker 映像从 Azure 注册表托管到 Azure Batch
Unable to host docker image from azure registry to azure batch
我是 docker 以及 azure batch 的新手。我目前遇到的问题是我有 2 个 dotnet 控制台应用程序,其中一个在本地运行(以编程方式在 azure 批处理上创建池、作业和任务),第二个我创建了一个 docker 图像并推送到 azure容器注册表。现在事情是当我从本地 运行 应用程序创建 cloudtTask 作为下面的 monetione
TaskContainerSettings cmdContainerSettings = new TaskContainerSettings(
imageName: "myrepository.azurecr.io/pipeline:latest",
containerRunOptions: "--rm"
);
CloudTask containerTask = new CloudTask(
id: "task1",
commandline: cmdLine);
containerTask.ContainerSettings = cmdContainerSettings;
Console.WriteLine("Task created");
await batchClient.JobOperations.AddTaskAsync(newJobId, containerTask);
Console.WriteLine("-----------------------");
并将其添加到 BatchClient,我在 azure batch(Azure 门户)中得到的期望是:
System.UnauthorizedAccessException: Access to the path '/home/_azbatch/.dotnet' is denied. ---> System.IO.IOException: Permission denied
--- End of inner exception stack trace ---
可能是什么问题?谢谢。
由于评论最终成为答案,我将其张贴在这里是为了让未来的观众清楚:
该任务需要 运行 并具有提升的权限。
例如
containerTask.UserIdentity = new UserIdentity(new AutoUserSpecification(elevationLevel: ElevationLevel.Admin, scope: AutoUserScope.Task));
有关详细信息,请参阅 the docs
我仍然无法从 docker 中提取图像,我正在使用 nodejs .. 以下是创建任务的配置
const taskConfig = {
"id": "task-new-2",
"commandLine": "bash -c 'node index.js'",
"containerSettings": {
"imageName": "xxx.xx.io/xx-test:latest",
"containerRunOptions": "--rm",
"username": "xxx",
"password": "tfDlZ",
"registryServer": "xxx.xx.io",
// "workingDirectory": "AZ_BATCH_NODE_ROOT_DIR"
},
"userIdentity": {
"autoUser": {
"scope": "pool",
"elevationLevel": "admin"
}
}
}
我是 docker 以及 azure batch 的新手。我目前遇到的问题是我有 2 个 dotnet 控制台应用程序,其中一个在本地运行(以编程方式在 azure 批处理上创建池、作业和任务),第二个我创建了一个 docker 图像并推送到 azure容器注册表。现在事情是当我从本地 运行 应用程序创建 cloudtTask 作为下面的 monetione
TaskContainerSettings cmdContainerSettings = new TaskContainerSettings(
imageName: "myrepository.azurecr.io/pipeline:latest",
containerRunOptions: "--rm"
);
CloudTask containerTask = new CloudTask(
id: "task1",
commandline: cmdLine);
containerTask.ContainerSettings = cmdContainerSettings;
Console.WriteLine("Task created");
await batchClient.JobOperations.AddTaskAsync(newJobId, containerTask);
Console.WriteLine("-----------------------");
并将其添加到 BatchClient,我在 azure batch(Azure 门户)中得到的期望是:
System.UnauthorizedAccessException: Access to the path '/home/_azbatch/.dotnet' is denied. ---> System.IO.IOException: Permission denied --- End of inner exception stack trace ---
可能是什么问题?谢谢。
由于评论最终成为答案,我将其张贴在这里是为了让未来的观众清楚:
该任务需要 运行 并具有提升的权限。
例如
containerTask.UserIdentity = new UserIdentity(new AutoUserSpecification(elevationLevel: ElevationLevel.Admin, scope: AutoUserScope.Task));
有关详细信息,请参阅 the docs
我仍然无法从 docker 中提取图像,我正在使用 nodejs .. 以下是创建任务的配置
const taskConfig = {
"id": "task-new-2",
"commandLine": "bash -c 'node index.js'",
"containerSettings": {
"imageName": "xxx.xx.io/xx-test:latest",
"containerRunOptions": "--rm",
"username": "xxx",
"password": "tfDlZ",
"registryServer": "xxx.xx.io",
// "workingDirectory": "AZ_BATCH_NODE_ROOT_DIR"
},
"userIdentity": {
"autoUser": {
"scope": "pool",
"elevationLevel": "admin"
}
}
}