26 lines
655 B
Docker
26 lines
655 B
Docker
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"]
|
||
|