Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to make a docker image of ssh mutual trust

Shulou Source: shulou.com Published: 2022-06-01 13:16:43 10月02日 Update

This article mainly explains "how to make a docker image of ssh mutual trust". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to make a docker image of ssh mutual trust".

DockerfileFROM ubuntu:16.04# packageRUN apt-get update Apt-get-y install sshCOPY ssh_config / etc/ssh/ssh_config# sshRUN sed-I 's/UsePAM yes/UsePAM no/g' / etc/ssh/sshd_config & & sed-I' s/PermitRootLogin without-password/PermitRootLogin yes/g' / etc/ssh/sshd_configRUN echo "root:root" | chpasswdRUN echo "root ALL= (ALL) ALL" > / etc/sudoersRUN ssh-keygen-t rsa-f ~ / .ssh/id_rsa-P''& & \ cat ~ / .ssh/id_rsa.pub > > ~ / .ssh/authorized_keysRUN mkdir / var/run/sshdEXPOSE 22CMD ["sh" "- c", "service ssh start & & bash"] generate image docker build-t sshimage. / verify ssh mutual trust

Start the first docker container, then enter the bash and execute hostname-I to get the ip.

# docker run-- rm-it sshimageroot@cbdf1f5e7e0f:/# hostname-i172.17.0.4

Start another container and execute ssh $ip.

# docker run-- rm-it sshimage * Starting OpenBSD Secure Shell server sshd [OK] root@ecaa455762df:/# ssh 172.17.0.4Warning: Permanently added '172.17.0.4' (ECDSA) to the list of known hosts.root@cbdf1f5e7e0f:~# hostname-i172.17.0.4

As you can see, ssh is a success.

Thank you for reading, the above is the content of "how to make a docker image of ssh mutual trust". After the study of this article, I believe you have a deeper understanding of how to make a docker image of ssh mutual trust, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Mirror production learning content container verification success that is ideas situations articles more knowledge knowledge points articles follow questions practice push generate Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MariaDB Docker OPPO Reno MySQL