惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
About on SuperTechFans
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
月光博客
月光博客
美团技术团队
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
爱范儿
爱范儿
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
T
The Blog of Author Tim Ferriss
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
I
InfoQ
B
Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
F
Fortinet All Blogs

博客园 - 勤劳の洗碗机

pyinstaller打包exe故障解析 curl 访问k8s api k8s 之HPA应用 statefulset 及storageclass hadoop 伪分布式 完全分布式 及HA部署 LDAP部署及实践 docker 制作自己的mysql镜像 k8s 压测工具之perf-test mysql相关(三)、主从复制 shell执行mysql脚本 分布式minio image-syncer 误删libc.so.6文件补救 docker 使用bind 动态扩容pvc k8s备份工具之velero jmeter使用 docker 制作自定义的nginx镜像 docker部署sharding-proxy
docker 制作ssh镜像
勤劳の洗碗机 · 2020-03-31 · via 博客园 - 勤劳の洗碗机

制作一个带有ssh的镜像

FROM centos:7
RUN yum install -y openssh-server openssh-clients sudo
RUN sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config

RUN useradd hadoop
RUN echo "hadoop:hadoop" | chpasswd
RUN echo "hadoop   ALL=(ALL)       NOPASSWD:ALL" >> /etc/sudoers
RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key
RUN ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ""
# 启动sshd服务并且暴露22端口
RUN mkdir /var/run/sshd
##加上此内容则是Hadoop账号免密登陆,hadoop需要
RUN chmod -R 755 /etc/ssh/
##加上此内容则是Hadoop账号免密登陆,hadoop需要
RUN chmod +s /usr/sbin/sshd
##加上此内容则是Hadoop账号免密登陆,hadoop需要
USER hadoop

RUN
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
RUN
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
EXPOSE
22
ENTRYPOINT [
"/usr/sbin/sshd","-D"]
docker build -t centos7-ssh:v1 .