Share via

Using Command Prompt to debug python scripts in my docker container

Vidar 21 Reputation points
2024-04-12T15:31:30.8433333+00:00

Hi I have published a docker container (Unix) in Azure.

It's got some Python scripts on it that I want to run from my Command Prompt on my local machine.

I have installed Azure CLI.

I login via Command Prompt - using the usual:

az login

I then enter the command to hopefully open a session with my container - by entering something like this:

az container exec --name fooCont --resource-group fooResourceGrp --exec-command "/bin/ssh"

and I only have one container here - so it should work; and it does because I can see in my logs that the command was accepted:

User's image

All good. However all I get in my Command Prompt is a new line/empty prompt. Not some kind of shell into my container where I can get to all the good stuff and start running my scripts.

So - what did I do wrong/miss out?

PS - I know I can do this directly from a browser - and connect in - but it times out after a short time and thats no good for me.

Thanks in advance.

Azure Container Instances
0 comments No comments

2 answers

Sort by: Most helpful
  1. Vidar 21 Reputation points
    2024-04-18T10:35:26.6166667+00:00

    Actually the problem was more down to a firewall issue that was stopping the command from executing properly - the typo was a valid point as well, so the command would not have worked regardless of the firewall issue.

    To fix the firewall issue I am alluding to:

    You must add *.serialconsole.azure.com to your firewall allow list.


  2. vipullag-MSFT 26,537 Reputation points Moderator
    2024-04-16T14:17:02.5433333+00:00

    Hello Vidar

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    Based on the details provided, look like the exec-command you are mentioning is not correct.

    Usually we access container with exec "/bin/sh" or "/bin/bash" not "/bin/ssh"

    Please change and see if that helps resolve the issue.

    Hope this helps.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.