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.

  • Persist Elastic Search Data in Docker Container
  • how to split string to array and loop over it?
  • Docker linux: How to start multiple console/terminals for one running container?
  • Links in docker-compose are not resolved
  • Pig `Failed to create DataStorage` to Hadoop cluster in Docker ENV
  • Docker root folders on Windows location
  •   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?

  • Connection refused by Docker container
  • Docker ping container on other nodes
  • Use docker-compose with multiple repositories
  • “Memory used” metric: Go tool pprof vs docker stats
  • Access Cassandra from separate docker container using docker-compose
  • Accessing Docker Node API from Digital Ocean
  • 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.