azure-cli: az container exec in azure devops throws (25, 'Inappropriate ioctl for device')
Az version 2.3.1
Describe the bug
When trying to use Azure DevOps Pipelines Azure CLI task az container exec
the shell outputs errors.
To Reproduce
az container exec --resource-group myRG --name myImageName --exec-command ./run.sh
Expected behavior
To be able to display the output of the container.
Environment summary
Azure Devops free agent running Ubuntu 18.04
Additional context
This error message is thrown:
[command]/bin/bash /home/vsts/work/_temp/azureclitaskscript1588671209398.sh
The command failed with an unexpected error. Here is the traceback:
(25, 'Inappropriate ioctl for device')
Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 215, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 625, in execute
raise ex
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 689, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 682, in _run_job
six.reraise(*sys.exc_info())
File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise
raise value
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 659, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 324, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 531, in default_command_handler
return op(**command_args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/container/custom.py", line 621, in container_exec
_start_exec_pipe(execContainerResponse.web_socket_uri, execContainerResponse.password)
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/container/custom.py", line 655, in _start_exec_pipe
oldtty = termios.tcgetattr(sys.stdin)
termios.error: (25, 'Inappropriate ioctl for device')
To open an issue, please run: 'az feedback'
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 13
- Comments: 31 (2 by maintainers)
@navba-MSFT this is still an issue, please reopen this issue.
In the end I emulated tty using the following
still seems to be an issue in 2024 @navba-MSFT
Getting this issue running against container app on an azure devops Ubuntu 22.04 agent
@navba-MSFT - Any update on this? Seeing the same behaviour on the following setup, running on
ubuntu-latest
:The workaround from @gary-x0pa works, but presents me with a different problem.