为了账号安全,请及时绑定邮箱和手机立即绑定

怎么理解这个Dockerfile

怎么理解这个Dockerfile

LEATH 2019-05-25 14:57:35
https://c.163.com/hub#/m/repo...它在最后启动了那个sshd服务但是在本机我用什么密码链接进去呢?FROMhub.c.163.com/public/centos:7.2.1511RUNyumcleanallRUNyuminstall-yyum-plugin-ovl||trueRUNyuminstall-yvimtarwgetcurlrsyncbzip2iptablestcpdumplesstelnetnet-toolslsofsysstatcroniepython-setuptoolsRUNyumcleanallRUNeasy_installsupervisorRUNcp-f/usr/share/zoneinfo/Asia/Shanghai/etc/localtimeEXPOSE22RUNmkdir-p/etc/supervisor/conf.d/RUN/usr/bin/echo_supervisord_conf>/etc/supervisord.confRUNecho[include]>>/etc/supervisord.confRUNecho'files=/etc/supervisor/conf.d/*.conf'>>/etc/supervisord.confCOPYsshd.conf/etc/supervisor/conf.d/sshd.confCMD["/usr/bin/supervisord"]下面是前面centos:7.2.1511的dockerfile文件FROMscratchMAINTAINERneteaseADDcentos-7-docker.tar.xz/LABELname="CentOSBaseImage"\vendor="CentOS"\license="GPLv2"\build-date="20160701"ADDCentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo#安装常用软件RUNyuminstall-yopenssh-server#初始化ssh登陆RUNssh-keygen-trsa-f/etc/ssh/ssh_host_rsa_key-N''RUNssh-keygen-tdsa-f/etc/ssh/ssh_host_dsa_key-N''RUNssh-keygen-tecdsa-f/etc/ssh/ssh_host_ecdsa_key-N''RUNssh-keygen-ted25519-f/etc/ssh/ssh_host_ed25519_key-N''RUNecho"RSAAuthenticationyes">>/etc/ssh/sshd_configRUNecho"PubkeyAuthenticationyes">>/etc/ssh/sshd_configRUNyumcleanall#启动sshd服务并且暴露22端口RUNmkdir/var/run/sshdEXPOSE22CMD["/usr/sbin/sshd","-D"]
查看完整描述

2 回答

?
Qyouu

TA贡献1786条经验 获得超11个赞

首先,吐槽一下,这个Dockerfile写的真没什么值得学习的,一点不符合最佳实践,一行命令用一个RUN。。。如果不用dockerexec的方式登录的话,用ssh跟正常的centos没区别,自己建立公钥私钥就行了。
                            
查看完整回答
反对 回复 2019-05-25
  • 2 回答
  • 0 关注
  • 440 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信