Docker File: FROM node:lts-alpine ENV NODE_ENV=production WORKDIR /usr/src/app COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*","sshd_config","entrypoint.sh", "./"] RUN npm install --production --silent && mv node_modules ../ COPY sshd_config /etc/ssh/ # Start and enable SSH RUN apk add openssh \ && echo "root:Docker!" | chpasswd \ && chmod +x //usr/src/app/entrypoint.sh \ && cd /etc/ssh/ \ && ssh-keygen -A COPY . . EXPOSE 3000 2222 #RUN chown -R node /usr/src/app #USER node ENTRYPOINT [ "/usr/src/app/entrypoint.sh" ] sshd_config: Port 2222 ListenAddress 0.0.0.0 LoginGraceTime 180 X11Forwarding yes Ciphers aes128-cbc,3des-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr MACs hmac-sha1,hmac-sha1-96 StrictModes yes SyslogFacility DAEMON PasswordAuthentication yes PermitEmptyPasswords no PermitRootLogin yes Subsystem sftp internal-sftp entrypoint.sh #!/bin/sh set -e # Get env vars in the Dockerfile to show up in the SSH session eval $(printenv | sed -n "s/^\([^=]\+\)=\(.*\)$/export \1=\2/p" | sed 's/"/\\\"/g' | sed '/=/s//="/' | sed 's/$/"/' >> /etc/profile) echo "Starting SSH ..." /usr/sbin/sshd exec npm start