Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssh-keygen: command not found in Docker

Tags:

docker

ssh

I am trying to run this below command inside a docker container (centos 7 as the base image)

ssh-keygen -t rsa -N ""

and I get this error:

ssh-keygen: command not found

And this is the Dockerfile I used to build the container

FROM centos:7

ENV VER "0.12.9"

RUN yum update -y && yum install wget -y && yum install unzip -y
RUN yum install epel-release -y && yum install ansible -y

RUN wget https://releases.hashicorp.com/terraform/${VER}/terraform_${VER}_linux_amd64.zip
RUN unzip terraform_${VER}_linux_amd64.zip
RUN mv terraform /usr/local/bin/  
RUN rm -rf terraform_${VER}_linux_amd64.zip

Can someone help me, Please?

like image 202
Jananath Banuka Avatar asked Jul 23 '26 13:07

Jananath Banuka


1 Answers

ssh-keygen is command provided by OpenSSH, you need to install it.

Add yum install openssh-clients -y to your Dockerfile.

FROM centos:7

ENV VER "0.12.9"

RUN yum update -y && yum install wget -y && yum install unzip -y
RUN yum install epel-release -y && yum install ansible -y && yum install openssh-clients -y

RUN wget https://releases.hashicorp.com/terraform/${VER}/terraform_${VER}_linux_amd64.zip
RUN unzip terraform_${VER}_linux_amd64.zip
RUN mv terraform /usr/local/bin/  
RUN rm -rf terraform_${VER}_linux_amd64.zip
like image 67
Karl-Marx Avatar answered Jul 25 '26 05:07

Karl-Marx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!