• 本帖最后由 杰克王 于 2018-3-23 14:28 编辑 *

问之前先问一句:docker做的镜像可以跟正常小鸡一样apt-get update吗?

事情是这样的,我想开个docker当vm用,找official image发现不能ssh。找别人做好的image发现不能apt-get update。

然后想自己制作一个image,却发现无论怎么设置ssh的密码都是错的,
RUN echo “root:root” | chpasswd 之后密码错误access denied

就算把别人做好的复制粘贴也说密码不对。

各位大佬有什么解决方法吗?

————————————————————
附代码:

FROM debian:latest
MAINTAINER Xxxxx "abc@example.com"

RUN apt-get update

RUN apt-get install -y openssh-server
RUN mkdir /var/run/sshd

RUN echo "root:rootroot" |chpasswd

RUN sed -ri 's/^#\sPermitRootLogin./PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config

EXPOSE 22

My custom

WORKDIR /root/

RUN echo 'deb http://ftp.jp.debian.org/debian/ stretch main' >> /etc/apt/sources.list
RUN echo 'deb-src http://ftp.jp.debian.org/debian/ stretch main' >> /etc/apt/sources.list
RUN echo 'deb http://security.debian.org/debian-security stretch/updates main' >> /etc/apt/sources.list
RUN echo 'deb-src http://security.debian.org/debian-security stretch/updates main' >> /etc/apt/sources.list

RUN apt-get update && apt-get install git nano supervisor curl wget cron screen -y

CMD ["/usr/sbin/sshd", "-D"]