from alpine:3.14
RUN rm -rf /var/cache/apk/* && \
rm -rf /tmp/* && \
set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
apk add --no-cache bash tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
/bin/bash
FROM alpine:3.14
RUN rm -rf /var/cache/apk/* && \
rm -rf /tmp/* && \
set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
apk add --no-cache openssh-server tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config && \
ssh-keygen -t rsa -P "" -f /etc/ssh/ssh_host_rsa_key && \
ssh-keygen -t ecdsa -P "" -f /etc/ssh/ssh_host_ecdsa_key && \
ssh-keygen -t ed25519 -P "" -f /etc/ssh/ssh_host_ed25519_key && \
echo "root:admin" | chpasswd
# 开放22端口
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]