在测试dockerfile根据环境变量来控制root用户密码时 出现报错如下
[root@docker01 centos_nginx]# ssh root@10.0.0.11 -p1022
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:tWl86iRp7oRjF2WQahyBVvBj8Sjc4wNZM67YNaRS6aE.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending RSA key in /root/.ssh/known_hosts:2
RSA host key for [10.0.0.11]:1022 has changed and you have requested strict checking.
Host key verification failed.
原因
每次失败之后 会删除失败的容器 并修改dockerfile 打算从新来过 但是每次重新启动时
指定的端口都是一样的
公钥验证不匹配 就 会出现这个错误
解决办法
[root@docker01 centos_nginx]# > ~/.ssh/known_hosts