Unfortunately, a single command to attach to a running container on a remote (SSH) host is not supported by the current CLI code
implementation.
I too have looked into doing the same. In my research the following links were the only official documentation relevant to this. However, both the attached-container
and dev-container
URI methods don't seem to be officially documented.
https://code.visualstudio.com/docs/editor/command-line
https://code.visualstudio.com/docs/remote/ssh#using-a-development-container-on-the-remoteshost
I have submitted a feature request via the vscode
GitHub repository, which has been accepted as a candidate for the backlog. If you agree that this could be a useful feature, please upvote (+1/"👍") the issue description.
Link to feature-request issue; https://github.com/microsoft/vscode/issues/242489
As the official documentation relevant to the OP's question is insufficient, this could be considered a duplicate of CLI code
command to attach VS Code to a running container on a remote SSH host (Dev Containers over Remote - SSH in VS Code)