Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container port binding working randomly #7196

Closed
2 tasks done
hawm opened this issue Jun 11, 2020 · 14 comments
Closed
2 tasks done

Container port binding working randomly #7196

hawm opened this issue Jun 11, 2020 · 14 comments

Comments

@hawm
Copy link

hawm commented Jun 11, 2020

  • I have tried with the latest version of my channel (Stable or Edge)
  • I have uploaded Diagnostics
  • Diagnostics ID: 20FB1524-C53D-4E05-8655-6ED43E68CFEC/20200611200628

Expected behavior

Container listen all my defined ports after start.

Actual behavior

Container ports are listening randomly, like below

  1. all listening
  2. part listening
  3. all not listening

Restart the container will randomly change to one of the states describe above.

Information

  • Windows Version: 10.0.19041 Build 19041
  • Docker Desktop Version: 2.3.1.0(45408)
  • Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: Windows WSL 2 backend

Steps to reproduce the behavior

Dockerfile: https://github.com/discourse/discourse_docker/blob/master/image/discourse_dev/Dockerfile
How i boot container: https://github.com/discourse/discourse/blob/master/bin/docker/boot_dev

  1. git clone https://github.com/discourse/discourse.git
  2. run bin/boot_dev to boot container inside repo which be cloned above.
  3. run sudo netstat -tulpn | grep LISTEN or whatever command to check port using you want, you may see one of the states i describe at Actual behavior section above, some ports are not listening at sometime.
  4. restart the container
  5. repeat step 3 to 5
@onomatopellan
Copy link

There is a known bug in WSL2 when coming from a shutdown state. Can you restart Windows and see if still happens?

@hawm
Copy link
Author

hawm commented Jun 12, 2020

There is a known bug in WSL2 when coming from a shutdown state. Can you restart Windows and see if still happens?

It's keep happening whatever i restart the Windows or WSL many times. I possible see some similar issues about this but not sure , could you point me out where the known bugs related issue it is?

@onomatopellan
Copy link

If a restart didn't fix it then is a different issue. Localhost port forwarding fails when Fast Startup is enabled microsoft/WSL#5298

@onomatopellan
Copy link

If it helps, I can't reproduce the issue in latest insider build 19645. Restarted the container twice.

Annotation 2020-06-12 135239

@hawm
Copy link
Author

hawm commented Jun 13, 2020

But i can reproduce it. And i had disable fast boot by follow microsoft/WSL#5298 (comment)
image
image
image

And i finally found that the higher ports (>10000) are working well??

@onomatopellan
Copy link

Ah, that sounds like microsoft/WSL#5306
What's the output of netsh int ipv4 show excludedportrange protocol=tcp ?

@hawm
Copy link
Author

hawm commented Jun 13, 2020

Ah, that sounds like microsoft/WSL#5306
What's the output of netsh int ipv4 show excludedportrange protocol=tcp ?

But the ports what i am using for container are not listing by the command output
image

@onomatopellan
Copy link

what's the output of netsh int ipv4 show dynamicport tcp ?

@hawm
Copy link
Author

hawm commented Jun 13, 2020

Protocol tcp Dynamic Port Range                                                                                        
 ---------------------------------                                                                                       
Start Port      : 1024                                                                                                  
Number of Ports : 13977    

@onomatopellan
Copy link

onomatopellan commented Jun 13, 2020

See #3171 (comment)

Mine:

Protocol tcp Dynamic Port Range                                                                                        
 ---------------------------------                                                                                       
Start Port      : 49152                                                                                                  
Number of Ports : 16384

@hawm
Copy link
Author

hawm commented Jun 13, 2020

Thanks a lot, it's working now.

@hawm hawm closed this as completed Jun 13, 2020
@onomatopellan
Copy link

You're welcome. Just out of curiosity, when was the last time you did a Windows clean install?

@hawm
Copy link
Author

hawm commented Jun 13, 2020 via email

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jul 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants