In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use docker to install a virtual machine and open a ssh connection. I hope you will get something after reading this article. Let's discuss it together.
Use docker to install the virtual machine and open the ssh connection I. requirements
Recently, there is a need to connect many linux systems to test software functions, but I only have a few virtual machines here, so I need to use docker to install dozens or hundreds of virtual machines for testing.
Second, install docker
Here will not demonstrate how to install, there are many on the Internet, you can also take a look at this https://www.runoob.com/docker/centos-docker-install.html, which has a variety of machine installation docker tutorials.
III. Concrete steps
1. Pull centos image
Docker pull centos:centos7
2. View / start the image
# View image docker images# boot image docker run-itd-- name my-centos centos:centos7
3. Enter the mirror image
# get the iddocker ps# of the container and enter the docker exec-it 9bd5d8e8a3e7 / bin/bash inside the container
4. Install software for the container
# install sshyum install-y openssh-server openssh-clients# change password command yum install-y passwd#service command yum install-y initscripts
5. Change the password
# change password command passwd
6. Modify sshd_config configuration file
# modify the file vi / etc/ssh/sshd_config# to find the UsePAM parameter and set it to no
7. Restart ssh and exit the container
# restart sshservice sshd start# and error System has not been booted with systemd as init system (PID 1) will be reported here. Can't operate.Failed to connect to bus: Host is down# just issue the following command directly. Using the command in the last step to start will solve this problem # exit container exit
8. Save the newly modified container as a new image
Docker commit 9bd5d8e8a3e7 my-ssh-centos
9. Start a new image
# Note to expose the external mapping port-privileged=true and the subsequent / sbin/init must have, start the container in privileged mode, otherwise you cannot start the service docker run-tid-- name my-ssh-0-p 50022 tid 22-- privileged=true 9bd5d8e8a3e7 / sbin/init after reading this article, I believe you have some understanding of "how to use docker to install a virtual machine and open a ssh connection", if you want to know more about it Welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.