I am having code-server container running and I am running az container exec --resource-group resourcename --name code-server --exec-command "ls" it is giving list of files and folder but if we run az container exec --resource-group resourcename --name code-server --exec-command "cd folder" not working showing error like rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"cd Angular\": executable file not found in $PATH"
-
what base image are you using ? some base image don't come with all of the basic linux commands.djsly– djsly2020-04-29 17:11:12 +00:00Commented Apr 29, 2020 at 17:11
-
@djsly Its codercom/code-server which has ubuntu 18.04San– San2020-04-30 03:04:21 +00:00Commented Apr 30, 2020 at 3:04
Add a comment
|
1 Answer
It's a common issue when you want to execute the commands inside the container instance. This feature does not absolutely support on Azure Container Instance. It only supports the single command and it shows here:
Azure Container Instances currently supports launching a single process with az container exec, and you cannot pass command arguments. For example, you cannot chain commands like in sh -c "echo FOO && echo BAR", or execute echo FOO.
2 Comments
San
any other solution so I can run some git commands while running
Charles Xu
@San Yeah, you can connect to the instance first with the command
az container exec -g group_name -n container_name --exec-command "/bin/bash", then you can execute the git command inside the instance.