How to solve the problem of docker telnet failure

藏色散人
Release: 2022-01-20 15:16:05
Original
12438 people have browsed it

Solution to docker telnet failure: 1. Check the configuration file; 2. Modify the port of the nginx configuration file to 80; 3. Reload it.

How to solve the problem of docker telnet failure

The operating environment of this article: centOS6.8 system, Docker version 18.09.x, Dell G3 computer.

How to solve the problem of docker telnet being blocked?

After the docker container is started, the telnet port is blocked

Today I use docker to deploy nginx. After the deployment is completed, check that the container has been started. At this time, I found that the telnet port was not accessible, and the local IP of telnet was not accessible. I directly reported Connection refused. I used 127.0.0.1 telnet. Although it was accessible, there was a problem and it reported Connection closed by foreign host. It was finally solved. It said The following processing ideas.

docker network inspect bridge #查看容器的IP为 172.17.0.2
Copy after login

curl container IP port 80, connection refused, curl container IP host port 8090, return normally. As shown below

How to solve the problem of docker telnet failure

#It’s very strange, it shouldn’t be, because when you look at the container process, you will find that 8090 is the host port, and port 80 is the container port

Finally, after checking the configuration file, I found that the port of the nginx configuration file was not 80, but written as 8090. After modifying the port of the nginx configuration file to 80 and adding a new one, the problem of unreachable telnet port was solved.

It is recommended that when starting the container, the host port and the container port should be consistent.

When using DOCKER, use the iptables -F command with caution. This command will clear the firewall rules. When the container communicates with the host, rules will be written in iptables by default.

Recommended learning: "docker video tutorial"

The above is the detailed content of How to solve the problem of docker telnet failure. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template