When I first came into contact with docker, I was really confused. I read the novice tutorial for a long time but still couldn't use it. Now at least I understand that docker is a container that can hold various software. If you put Ubuntu in it, this container can be regarded as Ubuntu used in other environments. downloadJust follow the tutorial, there is nothing much to say, here is the installation tutorial in Novice https://www.runoob.com/docker/windows-docker-install.html Mainly talk about how to create a docker service so that others can connect and use it through ssh (taking ubuntu as an example) Create a container You need an image. Friends who have used Ubuntu and other image installations should understand this. If you don’t have one, you can download one by using Create a container in the ubuntu image and map port 50003 of the docker server to port 22 of the container docker run -it -d -p 50003:22 ubuntu At this time, we can see that our container has started using Enter the container by ID docker exec -it a9cbce70127f /bin/bash At this point we have entered the container, that is, in the Ubuntu environment Install SSH Server apt-get update apt-get install passwd apt-get install openssh-server When you install the ssh service here, you will be asked to select the time zone. Just use the number to select it. I use 6 31 Tips: If you use the command and report that the command cannot be found, you can directly use Set the root password through the Start ssh service service ssh start You can use Modify the configuration file Open the configuration file using the vim editor vim /etc/ssh/sshd_config Write the following content in the configuration file (the # sign is a comment) PubkeyAuthentication yes # Enable public key and private key pairing authentication method AuthorizedKeysFile .ssh/authorized_keys # Public key file path PermitRootLogin yes # Root can use ssh to log in If there is no vim command here, just press the next one I mentioned above. In addition, this editor is different from the ordinary one. There are insert mode, command mode, etc. You need to check how to operate it specifically. Here is a brief introduction. After entering the editor, press Restart the service service ssh restart At this time, you can connect remotely. Open a cmd window and use This is the end of this article about how to use ssh to connect to the docker server. For more information about how to use ssh to connect to the docker server, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: HTML Tutorial: Collection of commonly used HTML tags (6)
>>: Vue implements image dragging and sorting
This post focuses on a super secret Flutter proje...
Table of contents background What is tablespace f...
Table of contents The basic concept of modularity...
The performance of your website or service depend...
1. Implementation principle of scrolling The scro...
Table of contents Slow query basics: optimizing d...
Question: After the computer restarts, the mysql ...
Preface: When we are making web pages, we often n...
This article describes how to install MySQL 5.7 f...
I can log in to MYSQL normally under the command ...
I have been depressed for a long time, why? Some t...
A simple MySQL full backup script that backs up t...
In an unordered list ul>li, the symbol of an u...
1: Introduction to syslog.conf For different type...
I made a Dockerfile for openresty on centos7 and ...