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

推荐订阅源

V
V2EX
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
罗磊的独立博客
小众软件
小众软件
I
InfoQ
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
MyScale Blog
MyScale Blog
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
H
Help Net Security
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
P
Proofpoint News Feed
博客园 - 司徒正美
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
Jina AI
Jina AI
N
Netflix TechBlog - Medium

博客园 - 勤劳の洗碗机

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 .