美文网首页
debian8 -ssh docker镜像

debian8 -ssh docker镜像

作者: 雨中星辰0 | 来源:发表于2024-08-01 22:24 被阅读0次
FROM debian:jessie

# 修改软件源 
RUN deb http://mirrors.tuna.tsinghua.edu.cn/debian-elts jessie main contrib non-free > /etc/apt/sources.list 
 #  echo "deb http://mirrors.aliyun.com/debian-archive/debian/ jessie main non-free contrib" > /etc/apt/sources.list \
  # 更新本地包列表
  && apt-get update \
  # 安装常用软件
  && apt install --force-yes -y net-tools vim ssh \
  # 允许root远程登陆  
  && sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
# 设置开机启动  
  && update-rc.d ssh enable \
# 设置用户名root的密码为root  
  && echo root:root|chpasswd \
# 创建特权分离目录,不创建会报Missing privilege separation directory: /var/run/sshd错误
  && mkdir -p /var/run/sshd \
  && chmod 0755 /var/run/sshd

# 监听SSH端口
EXPOSE 22

# 启动SSH服务
CMD ["/usr/sbin/sshd", "-D"]

相关文章

网友评论

      本文标题:debian8 -ssh docker镜像

      本文链接:https://www.haomeiwen.com/subject/gitahjtx.html