0
votes

I am running an R Shiny app inside a container in Azure Container Instance. Via a DevOps pipeline whenever I change the source code of my App, I recreate the container in the Build pipeline and update the Container Instance via an Azure Cli command in the Release pipline via az container create and az container restart.

After spinning it up I need to run a bash command - namely, automatically adjusting a file within the created container. In local Docker this would be

docker exec {containerName} /bin/bash -c "echo `"var1 = \`"val1`"`" >> /home/shiny/.Renviron"

This means: run a bash command in the container to push some text into the .Renviron file within the container.

Now the Azure Container Instance says you cannot pass command arguments for az container exec: https://docs.microsoft.com/en-us/azure/container-instances/container-instances-exec

How would you then in an automated build/release process in Azure go for building, releasing and configuring a container?

I do not want to set those values within the build pipeline as I want to use the same image for different staging areas setting those values accordingly.

Many thanks in advance for your help.

1

1 Answers

0
votes

I am very new to azure container instances, so I may not understand your aims but it seems another way of achieving this:

I do not want to set those values within the build pipeline as I want to use the same image for different staging areas setting those values accordingly.

could be to modify your parameter values upon container creation using the --command-line flag mentioned here. Something like

az container create -g MyResourceGroup --name myapp --image myimage:latest --command-line "/bin/sh -c '/path to/myscript.sh val1 val2'"

in which myscript.sh runs your app with the indicated values.