0

I am facing issue while connecting SFTP with Error: connect: Remote host refused connection using docker.

FYI it is working fine/as expected without docker.

Logs without docker (where the SFTP connection successfully established)

CLIENT[sftp]: connect: Debugging turned on
CLIENT[sftp]: ssh2-sftp-client Version: 9.0.4  {
 "node": "16.14.1",
 "v8": "9.4.146.24-node.20",
 "uv": "1.43.0",
 "zlib": "1.2.11",
 "brotli": "1.0.9",
 "ares": "1.18.1",
 "modules": "93",
 "nghttp2": "1.45.1",
 "napi": "8",
 "llhttp": "6.0.4",
 "openssl": "1.1.1m+quic",
 "cldr": "40.0",
 "icu": "70.1",
 "tz": "2021a3",
 "unicode": "14.0",
 "ngtcp2": "0.1.0-DEV",
 "nghttp3": "0.1.0-DEV"
}
CLIENT[sftp]: connect: Connect attempt 1
Custom crypto binding not available
Local ident: 'SSH-2.0-ssh2js1.11.0'
Client: Trying <hostname> on port 22 ...
Socket connected

Logs with docker container (where the SFTP connection getting error Error: connect: Remote host refused connection

CLIENT[sftp]: connect: Debugging turned on
CLIENT[sftp]: ssh2-sftp-client Version: 9.0.4  {
 "node": "16.18.1",
 "v8": "9.4.146.26-node.22",
 "uv": "1.43.0",
 "zlib": "1.2.11",
 "brotli": "1.0.9",
 "ares": "1.18.1",
 "modules": "93",
 "nghttp2": "1.47.0",
 "napi": "8",
 "llhttp": "6.0.10",
 "openssl": "1.1.1q+quic",
 "cldr": "41.0",
 "icu": "71.1",
 "tz": "2022b",
 "unicode": "14.0",
 "ngtcp2": "0.8.1",
 "nghttp3": "0.7.0"
}
CLIENT[sftp]: connect: Connect attempt 1
Custom crypto binding available
Local ident: 'SSH-2.0-ssh2js1.11.0'
Client: Trying <hostname> on port 27017 ...
Socket error: connect ECONNREFUSED X.XX.X.XXX:XXXXX
CLIENT[sftp]: connect errorListener - ignoring handled error
CLIENT[sftp]: Global: Ignoring handled error: connect ECONNREFUSED X.XX.X.XXX:XXXXX
CLIENT[sftp]: connect: Remote host refused connection (ECONNREFUSED)

I also tried to install

RUN apt update && apt install  openssh-server sudo -y

but not get any success.

Can anyone suggest me what is the issue? Here is my Dockerfile

FROM node:16

WORKDIR /home

COPY package*.json ./
COPY yarn.lock ./
RUN yarn install

COPY *.sh ./
COPY ./src src

EXPOSE 3000
CMD chmod u+x *.sh && ./docker-start.sh

0 Answers0