SSH'ing into multi-container app

Anselm Coogan 1 Reputation point
2021-02-18T15:43:29.75+00:00

Hi,
I have a multi-container app running as an app service; however, I'm having trouble ssh'ing into it.

In the dockerfile of my webapp I'm exposing ports 8000 and 2222.

Request to port 80 are reverse-proxied via nginx and if appropriate forwarded to my app running on port 8000.
That all works fine.

However, I can't connect via remote ssh although I'm running sshd via supervisord (/usr/sbin/sshd -D -f /etc/ssh/sshd_config) on port 2222 of my application.
Also setting the password for root to "Docker!" in my docker build as per the documentation.
No idea what's going wrong.

When I look at the logs at LogFiles/webssh/pm2.err I am however seeing this:

/opt/nodejs/9.4.0/lib/node_modules/pm2/lib/ProcessContainerFork.js:30
    import(url.pathToFileURL(process.env.pm_exec_path));
    ^^^^^^

SyntaxError: Unexpected token import
    at new Script (vm.js:51:7)
    at createScript (vm.js:138:10)
    at Object.runInThisContext (vm.js:199:10)
    at Module._compile (module.js:624:28)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:193:16)
(node:259) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
Error: Invalid username
    at Client.connect (/opt/webssh/node_modules/ssh2/lib/client.js:209:11)
    at Namespace.<anonymous> (/opt/webssh/index.js:143:8)
    at Namespace.emit (events.js:165:20)
    at Namespace.emit (/opt/webssh/node_modules/socket.io/lib/namespace.js:209:10)
    at /opt/webssh/node_modules/socket.io/lib/namespace.js:177:14
    at process._tickCallback (internal/process/next_tick.js:150:11)

But maybe this is just a result from failing to connect...

Any tips appreciated!
Thanks

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,958 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 26,146 Reputation points Microsoft Employee
    2021-02-19T05:36:26.107+00:00

    @Anselm Coogan , are you accessing SSH through SCM? Per stated in https://learn.microsoft.com/en-us/azure/app-service/configure-custom-container?pivots=container-linux#enable-ssh, external connections aren't allowed through openssh. The same section also has a link to NodeJS 10.14 repo as an example of how it's enabled. You can compare commands with what's in the repo for any differences. If you're still having issues, can you post your dockerfile and docker compose down below?

    Regards,
    Ryan

    0 comments No comments