简体   繁体   English

如何在 Azure 上交互式运行 Docker 容器

[英]How to run Docker container interactively on Azure

I am trying to run R interactively on Azure Docker container.我正在尝试在 Azure Docker 容器上以交互方式运行 R 。 I am following this tutorial .我正在关注本 教程 In release CLI I added -ti --rm as per tutorial.在发布 CLI 中,我按照教程添加了-ti --rm Here is how command looks这是命令的外观

az container create --resource-group some_endless_details

az container start --resource-group some_resource_group_name --name my_demo_container  -ti --rm 

My Dockerfile contains has just one line FROM rocker/r-ver:4.0.2我的 Dockerfile 包含只有一行FROM rocker/r-ver:4.0.2

My release fails with the following error:我的发布失败并出现以下错误:

UnrecognizedArgumentError: unrecognized arguments: -ti --rm

Any suggestions?有什么建议么?

It seems you just want to create a docker environment that can run the R application.您似乎只想创建一个可以运行 R 应用程序的 docker 环境。 And you want to deploy the docker container on ACI and interact with it.并且您想在 ACI 上部署 docker 容器并与之交互。 Unfortunately, ACI does not support the parameters like -it and --rm like docker.不幸的是,ACI 不支持像 docker 这样的-it--rm参数。 The right way to interact with the ACI is that creates a bash connection with the ACI.与 ACI 交互的正确方法是创建与 ACI 的 bash 连接。 You need to do two steps.你需要做两个步骤。

  1. create the ACI with the CLI:使用 CLI 创建 ACI:

    az container create -g group_name -n container_name --image rocker/r-ver:4.0.2 --ip-address public --command-line "tail -f /dev/null" az container create -g group_name -n container_name --image rocker/r-ver:4.0.2 --ip-address public --command-line "tail -f /dev/null"

  2. create a bash connection with the ACI:创建与 ACI 的 bash 连接:

    az container exec -g group_name -n container_name --exec-command "/bin/bash" az container exec -g group_name -n container_name --exec-command "/bin/bash"

Generally, you can create a bash connection with the existing ACI with the second command, but in my test, it seems the command cannot create the connection.通常,您可以使用第二条命令与现有 ACI 创建 bash 连接,但在我的测试中,该命令似乎无法创建连接。 So I recommend you go to the Azure portal and find the ACI, then you can choose the connect and select the /bin/bash and it will look like this:所以我推荐你 go 到 Azure 门户并找到 ACI,然后你可以选择 connect 和 select /bin/bash ,它看起来像这样:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM