Handshake with client failed in lldb remote server running inside docker

I am trying to perform remote debugging from vscode to a lldb-server-6.0 running inside a docker container. I am using ssh to pipe commands to the lldb-server. But, the server is not establishing proper connection with the container.

My launch.json file looks like this:

{
"version": "0.2.0",
"configurations": [
    {
        "name": "LLDB Debug",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/project/a.out",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "pipeTransport": {
            "debuggerPath": "/usr/bin/lldb",
            "pipeProgram": "ssh",
            "pipeArgs": [
                "[email protected]",
                "-p",
                "7142"
            ],
            "pipeCwd": ""
        },
        "sourceFileMap": {
            "/tmp/project": "./project"
        },
        "MIMode": "lldb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ]
    },
]
}

In a separate terminal, I have lldb-server running as:

lldb-server-6.0 platform --listen "*:7142" --server

Now, when I hit F5 and start debugging I get the following messages:

In the lldb-server terminal:

Connection established.
error: handshake with client failed   
lldb-server exiting..

And VSCode gives following message:

Unable to establish a connection to LLDB.
ssh_exchange_identification: Connection closed by remote host

VSCode is able to send request to the service. Maybe ssh is not properly set up inside the container so it is not responding. Are there any alternatives to pipe commands to the container, or how can I fix the problem.?

Source: StackOverflow