Проблема решилась добавлением StrictHostKeyChecking no в конфиг sshd
.job_template: &main_job
script:
- "which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )"
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY1" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS1" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- echo "deploy to $D_SERVER"
- echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
- ssh $D_SERVER "docker stop $CI_PROJECT_NAME" || true
- ssh $D_SERVER "docker rm $CI_PROJECT_NAME" || true