user1700890
user1700890

Reputation: 7732

How to run Docker container interactively on Azure

I am trying to run R interactively on Azure Docker container. I am following this tutorial. In release CLI I added -ti --rm as per tutorial. 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

My release fails with the following error:

UnrecognizedArgumentError: unrecognized arguments: -ti --rm

Any suggestions?

Upvotes: 0

Views: 532

Answers (1)

Charles Xu
Charles Xu

Reputation: 31454

It seems you just want to create a docker environment that can run the R application. And you want to deploy the docker container on ACI and interact with it. Unfortunately, ACI does not support the parameters like -it and --rm like docker. The right way to interact with the ACI is that creates a bash connection with the ACI. You need to do two steps.

  1. create the ACI with the CLI:

    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:

    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. 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:

enter image description here

Upvotes: 4

Related Questions