# centos7.7 - SSHDv1.0
The FROM centos: 7.7.1908
The RUN/etc/mv yum. Repos. D/*. Repo/MNT & amp; & Echo - e "[FTP] \ nname=FTP \ nbaseurl=ftp://172.17.0.1/centos7.7\nenabled=1\ngpgcheck=0" & gt; The/etc/yum. Repos. D/FTP. Repo & amp; & Yum clean all & amp; & Yum makecache & amp; & Yum -y install openssh server
-The RUN systemctl start SSHD & amp; & Systemctl enable SSHD & amp; & Echo "123456" | passwd root - stdin
EXPOSE 22
CMD/"/usr/sbin/init "
In the build command to create new image times this error:
The command '/bin/sh -c systemctl start SSHD & amp; & Systemctl enable SSHD & amp; & Echo "123456" | passwd root -- stdin 'returned a non - zero code: 1
The error in manual production mirror also met, when I was in the run a new container with the/usr/sbin/init is not an error, but this method cannot be used in dockerfile build mirror here ah, that should be how to solve this problem, thank you,
CodePudding user response:
Need to add parameters - ring inside the run command execution systemctl commandCodePudding user response:
Dockerfile cannot use systemctl inside you can manually start the SSHD, RUN the/usr/sbin/SSHD