How do i make this non-interactive?

I am trying to install pseudo-distributed hadoop installation. In that, i am installing ssh for passwordless authentication. I am running it from inside a docker file.

   RUN /usr/bin/sudo apt-get install -y openssh-server openssh-client
   WORKDIR /home/hadoop_admin
   RUN mkdir /home/hadoop_admin/.ssh
   RUN chmod 700 /home/hadoop_admin/.ssh
   RUN ssh-keygen -t rsa -P "" -f ~/.ssh/id_dsa
   RUN cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

When i start ssh service, it asks for yes/no like the below. I want to make it yes always.

  • Hadoop (yarn) control resource consumption (CPU and RAM), on docker
  • Can't use 127.0.0.1 to connect mysql server docker container, but can use IP?
  • How To Create And Start Docker Container node, detached mode using docker-java
  • automatic log rotation is not executing
  • Testing a Docker Image
  • How to debug rails application which is running inside docker container
  •   The authenticity of host 'localhost (::1)' can't be established.
      ECDSA key fingerprint is [long hexa key value]
      Are you sure you want to continue connecting (yes/no)? yes
    

    Any suggestions?

  • export the IBM Docker container images in the registry
  • Why doesn't Docker Toolbox work on Mac 10.10.5?
  • All job data lost when running Jenkins in Docker and when Jenkins container is stopped
  • Is it possible to deploy a docker hub publicly hosted image to Kubernetes Container Engine without uploading it to Containers Registery?
  • Container healthcheck status via tasks json
  • docker toolbox, can connect to containers launched with kitematic but not with the cli?
  • One Solution collect form web for “How do i make this non-interactive?”

    This post has several considerations.

    1) What is exactly the command that you are executing, so this error is raised ?Because it recalls me that is a ssh client trying to access to the ssh server. If so, you can add this parameter to the ssh client to avoid the error … but it has security considerations.

    echo 'Host * StrictHostKeyChecking no' >> ~/.ssh/config
    

    2) You can use a docker base image that has, among many other things, already the SSH server configured http://phusion.github.io/baseimage-docker/

    3) For the ssh client that is trying to connect to the server, you could auto-populate known_host before connecting via ssh

    ssh-keyscan -t rsa,dsa localhost >> $HOME/.ssh/known_hosts
    

    4) If you are using docker containers, you should not need to SSH to the containers. If you SSH need to manage the containers it is recommended to use nsenter or any other alternative.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.