国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 操作系統 > 正文

創建帶sshd服務的docker image

2024-06-28 13:24:27
字體:
來源:轉載
供稿:網友
創建帶sshd服務的docker image

參考:https://docs.docker.com/examples/running_ssh_service/

1.創建一個空目錄用于存放Dockerfile

mkdir -p/home/thm/docker/test/new_image

vim Dockerfile

Dockerfile的內容為:

  FROM tanghuimin0713/Ubuntu_amd64:14.04  RUN apt-get update  RUN apt-get install -y openssh-server  #RUN mkdir /var/run/sshd  RUN sed -i 's/^PermitRootLogin/#PermitRootLogin/' /etc/ssh/sshd_config  RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config  RUN echo "root:root" | chpasswd  EXPOSE 22

2. build a image

docker build -t tanghuimin0713/ubuntu_amd64_ssh .

3. run a container

docker run -d -p 2222:22 tanghuimin0713/ubuntu_amd64_ssh /usr/sbin/sshd -D

4. 主機下ssh登陸docker容器

ssh root@localhost -p 2222

密碼為:root

root@ubuntu:/home/thm/docker/test/new_image# ssh root@localhost -p 2222The authenticity of host '[localhost]:2222 ([127.0.0.1]:2222)' can't be established.ECDSA key fingerPRint is bd:41:3f:e4:e3:bd:b4:46:54:fe:1b:46:eb:60:f3:73.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '[localhost]:2222' (ECDSA) to the list of known hosts.root@localhost's passWord: Welcome to Ubuntu 14.04 LTS (GNU/linux 3.13.0-32-generic x86_64) * Documentation:  https://help.ubuntu.com/The programs included with the Ubuntu system are free software;the exact distribution terms for each program are described in theindividual files in /usr/share/doc/*/copyright.Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted byapplicable law.root@db36812760ac:~# 

成功。

若在ssh登陸時提示:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@    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 ECDSA key sent by the remote host isbd:41:3f:e4:e3:bd:b4:46:54:fe:1b:46:eb:60:f3:73.Please contact your system administrator.Add correct host key in /root/.ssh/known_hosts to get rid of this message.Offending ECDSA key in /root/.ssh/known_hosts:5  remove with: ssh-keygen -f "/root/.ssh/known_hosts" -R 172.17.0.2ECDSA host key for 172.17.0.2 has changed and you have requested strict checking.Host key verification failed.

rm $HOME/.ssh/known_hosts即可。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 监利县| 普定县| 天镇县| 马龙县| 乌拉特前旗| 冕宁县| 伊金霍洛旗| 泗洪县| 通道| 景泰县| 临泉县| 菏泽市| 裕民县| 岗巴县| 行唐县| 麻江县| 内丘县| 博爱县| 潮安县| 临夏市| 横山县| 南皮县| 奎屯市| 海盐县| 焉耆| 澄迈县| 婺源县| 阳信县| 昌黎县| 油尖旺区| 松滋市| 通州区| 蕲春县| 克拉玛依市| 陆良县| 珠海市| 揭东县| 新昌县| 佛学| 德保县| 南雄市|