Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image: SSH command is gone #27841

Open
inno-steffg opened this issue Nov 14, 2023 · 7 comments
Open

Docker image: SSH command is gone #27841

inno-steffg opened this issue Nov 14, 2023 · 7 comments
Assignees
Labels
Account az login/account Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Possible-Solution question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Similar-Issue SSH VM SSH

Comments

@inno-steffg
Copy link

Describe the bug

Former versions of the "standard" docker image (mcr.microsoft.com/azure-cli:latest) contained ssh command (formerly provided by installed openssh package).

This is no longer the case for version 2.54.0 build at 2023-11-08T05:17:55Z.

C:\Users\inno-steffg>docker run --rm -it mcr.microsoft.com/azure-cli:2.53.1
076587dd38b9:/# ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
           [-i identity_file] [-J [user@]host[:port]] [-L address]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] destination [command [argument ...]]
C:\Users\inno-steffg>docker run --rm -it mcr.microsoft.com/azure-cli:2.54.0
8f4637cae6e2:/# ssh
bash: ssh: command not found
8f4637cae6e2:/# find -name "ssh"
./usr/share/bash-completion/completions/ssh

Having the ssh command within the container allowed to forward ports using a combination of Azure bastion and Azure virtual linux machine.

From the Azure CLI documentation, which shows how to map local SSH keys into the container, I concluded, that ssh is a part of the image.

Related command

docker run --rm -it mcr.microsoft.com/azure-cli sh -c "az extension add -n ssh && az login --use-device-code && az ssh vm --ip azureVm"

Errors

Failed to run ssh command with error: [Errno 2] No such file or directory: 'ssh'.
Ensure OpenSSH is installed correctly.
Alternatively, use --ssh-client-folder to provide OpenSSH folder path.

Issue script & Debug output

Expected behavior

SSH console opens

Environment Summary

azure-cli 2.54.0

core 2.54.0
telemetry 1.1.0

Dependencies:
msal 1.24.0b2
azure-mgmt-resource 23.1.0b2

Python location '/usr/local/bin/python'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.11.6 (main, Oct 19 2023, 05:43:48) [GCC 12.2.1 20220924]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

@inno-steffg inno-steffg added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Nov 14, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Account az login/account labels Nov 14, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that VM SSH Service Attention This issue is responsible by Azure service team. SSH labels Nov 14, 2023
Copy link

Hi @inno-steffg
Find similar issue #22084.

Issue title az ssh vm failure
Create time 2022-04-16
Comment number 11

Possible solution:
The issue is that the ssh command is no longer available in the latest version of the "standard" docker image (mcr.microsoft.com/azure-cli:latest). This command was previously provided by the installed openssh package. The ssh command within the container allowed to forward ports using a combination of Azure bastion and Azure virtual linux machine.

One solution to this issue is to update the ssh extension to version 1.1.1. Another solution is to install OpenSSH on your box and then create a PATH environment variable and use a new cmd session to run the same CLI command. You can also specify flag --ssh-client-folder with c:\windows\sysnative\openssh or set c:\windows\sysnative\openssh to the PATH environment variable.


Please confirm if this resolves your issue.

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 14, 2023

Thank you for opening this issue, we will look into it.

@inno-steffg
Copy link
Author

Bot wrote:

One solution to this issue is to update the ssh extension to version 1.1.1.

The ssh extension is installed newly and on version 2.0.2, az --version:

azure-cli                         2.54.0
...
Extensions:
ssh                                2.0.2
...

@deeje2
Copy link

deeje2 commented Nov 14, 2023

Can I also add that the git command is missing, too.

+ git submodule update --init --recursive
bash: git: command not found

@bebound
Copy link
Contributor

bebound commented Nov 14, 2023

We removed these packages to reduce the docker image size in 2.54.0, See #27567
You need to install these packages manually.

@yonzhan yonzhan removed the Azure CLI Team The command of the issue is owned by Azure CLI team label Nov 14, 2023
@inno-steffg
Copy link
Author

As shown in the related command example, ssh a basic tool required for some functionality of the ssh extension.

@RMacfarlane
Copy link

The change to using alpine linux as a base also broke my team's CI, which was assuming curl was installed. We're using the previous version of the image for now, and perhaps later will change our pipeline to just install curl and whatever other tools we need ourselves, but just wanted to chime in to say that this change was disruptive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Possible-Solution question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Similar-Issue SSH VM SSH
Projects
None yet
Development

No branches or pull requests

6 participants