Because you are installing the Windows version of Docker environment, Hyper-V is enabled. The result was that IDEA warned of port 1099 occupancy when running Tomcat, and a solution was successfully found after exploration.
One, reason analysis
First we can look at the default port occupancy range of our system;
netsh int ipv4 show dynamicport tcp
Microsoft Windows [Version 10.0.18363.752] (C) 2019 Microsoft Corporation. All rights reserved. C: \ Users \ Chirius > netsh int ipv4 show dynamicport dynamic TCP protocol TCP port range -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- start port: 1024 port number: 13977
We can see that the default TCP dynamic port range for Windows is 1024-13977. When we turn on Hyper-V, the system will by default assign some reserved ports for Hyper-V to use:
netsh interface ipv4 show excludedportrange protocol=tcp
C:\Users\Chirius> Netsh Interface IPv4 Show ExcludedReportRange Protocol = TCP Port Exclusion Scope Start Port End Port ---------- -------- 1026 1125 1226 1325 1326 1425 1426 1525 1625 2180 2279
We can see that TOMCAT requires JMX port 1099 for IDEA to run, which is in the port exclusion range. As a result, IDEA requires port 1099, which will be used, and you will not be able to run it.
II. Solution
Run CMD as administrator, reset the port, and then restart
C:\Users\Chirius>netsh winsock reset
Your TCP port exclusion may not include port 1099, so you can certainly run Tomcat with your IDEA. But there’s no telling when you’ll show up.
Third, the ultimate solution
3.1 close the Hyper – V
Microsoft Windows [Version 10.0.18363.752] (C) 2019 Microsoft Corporation. All rights reserved. C:\WINDOWS\system32>dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
Or go the old-fashioned way, under Programs and Features on the Control Panel, go to Windows Features and uncheck Hyper-V. Both methods require a restart.
3.2 Modify the dynamic port range
Run CMD as an administrator
C:\WINDOWS\system32>netsh int ipv4 set dynamicport TCP start=49152 num=16383 C:\WINDOWS\system32>netsh int ipv4 set dynamicport udp start=49152 num=16383
And then check the results
C: \ Users \ Chirius > netsh int ipv4 show dynamicport dynamic TCP protocol TCP port range -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- start port: 49152 port number: 16383
Open the Hyper – 3.3 V
C:\ Windows \ System32 > Dism.exe /Online/enable-feature :Microsoft-Hyper-V /All 10.0.18363.752 enable one or more functions [= = = = = = = = = = = = = = = = = = = = = = = = = = 100.0% = = = = = = = = = = = = = = = = = = = = = = = = = =] operation completed successfully. Restart Windows to complete the operation. Do you want to restart the computer immediately? (Y/N)
Or go the old-fashioned way, under Programs and Features on the Control Panel, go to Windows Features and uncheck Hyper-V. Both methods require a restart.
After using the Ultimate Solution, you will find that your IDEA can run normally again. * exclude port (); * exclude port ();
netsh int ipv4 add excludedportrange protocol=tcp startport=50051 numberofports=1
After using the above command we can exclude a port separately, to ensure that the changed port will not be used by other applications.