赞
踩
FROM ubuntu:22.04 # 基础镜像 可替换为其他镜像
USER root
RUN echo 'root:root' |chpasswd
RUN apt-get update -y \
&& apt-get install -y git wget curl
RUN apt-get install -y openssh-server vim && apt clean \
&& rm -rf /tmp//* /var/lib/apt/lists/* /var/tmp* \
&& echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN mkdir -p /var/run/sshd
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
-p xxxx:22
挂载内部端口 22
docker run -d -p 30969:22 docker.io/library/target-image
USER root
RUN echo 'root:root' |chpasswd
# 账号:密码
openssh-server
和 vim
apt-get update -y \
&& apt-get install -y openssh-server vim
"PermitRootLogin yes"
到 /etc/ssh/sshd_config
文件echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
mkdir -p /var/run/sshd
wget
和 curl
apt-get update -y && \
apt-get install -y git wget curl
CMD ["/usr/sbin/sshd", "-D"]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。