Docker Community Forums

Share and learn in the Docker community.

Centos docker :libssh2 handshake failure

I’m having two application which are running on a separate docker containers.
Running OB-BAA (open source broadband forum project) in one container.
Running my application in another container. My usecase is to establish a ssh connection between my application and OB-BAA .I’m using libssh2 in my application for establishing a connection.
When I’m running my application from the host machine, i’m able to connect OB-BAA container.
But when i tried to run my application in a separate centos docker container ,
while establishing a connection libssh2_session_handshake got failed with error code as -8(LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE).
I’m not sure why key exchange got failed when running inside a docker.
I tried the following ways

  1. generate the ssh-key again by ssh-keygen.
    2.copied the /root/.ssh folder from my linux machine to docker.
    3.Sharing the ssh-agent between host machine and docker by adding the below in docker-compose file


    • SSH_AUTH_SOCK=/ssh-agent
    • ${SSH_AUTH_SOCK}:/ssh-agent

Below is my Dockerfile

FROM centos:7

RUN yum -y update &&
yum -y groupinstall ‘Development Tools’ &&
yum -y install vim mlocate flex flex-devel net-tools gdb screen &&
yum -y install autoconf libtool &&
yum -y install libssh2 libssh2-devel libxml2-devel openssl-devel readline-devel ncurses-devel &&
yum -y install initscripts

RUN mkdir -p /var/run/sshd
RUN yum -y update
RUN yum install -y openssh-server
RUN ssh-keygen -A
RUN ssh-keygen -t rsa

Tried running sshd in docker by

/usr/sbin/sshd -D

None of the above methods worked for me.
I’m missing anything to be done inside a docker?