bev-project/docker/Dockerfile.ssh

26 lines
655 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM localhost/bevfusion:ssh
# 安装SSH服务器如果镜像中还没有
RUN apt-get update && \
apt-get install -y openssh-server && \
mkdir -p /var/run/sshd && \
rm -rf /var/lib/apt/lists/*
# 配置SSH
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
sed -i 's/UsePAM yes/UsePAM no/' /etc/ssh/sshd_config
# 设置root密码
RUN echo 'root:Aa@123456' | chpasswd
# 生成SSH主机密钥
RUN ssh-keygen -A
# 暴露SSH端口
EXPOSE 22
# 启动SSH服务
CMD ["/usr/sbin/sshd", "-D"]