-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add In_WSL function to check whether the host runs on WSL #12799
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
Conversation
Introduced dynamic port allocation for Azurite containers using available TCP ports, replacing fixed port mappings. Added detection for WSL environments to adjust host settings for improved compatibility. Enhanced request proxying with detailed logging and error handling for robust communication.
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to LocalStack! Thanks for raising your first Pull Request and landing in your contributions. Our team will reach out with any reviews or feedbacks that we have shortly. We recommend joining our Slack Community and share your PR on the #community channel to share your contributions with us. Please make sure you are following our contributing guidelines and our Code of Conduct.
I have read the CLA Document and I hereby sign the CLA |
S3 Image Test Results (AMD64 / ARM64) 2 files 2 suites 8m 55s ⏱️ Results for commit e77b206. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @paolosalvatori! thanks for being a WSL champion :-) we have few users on windows, but this may change with the growing azure team.
just two minor things:
- do we need the solutions file checked into the repo? we normally don't check in environment-specific files
- a more descriptive PR title for the commit history would be great ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From your PR description, I can see that you are fighting with a pretty specific issue (running LocalStack in host mode - for development purposes). I am wondering if there is a more generic way to solve the Docker networking issue you might be facing.
Maybe @simonrw or @dfangl could have an idea here?
However, the implementation is looking good, and with Mac, Linux, and WSL, most host systems are covered, so it's also fair to keep the function as is.
The sln
file should be removed though before merging this PR.
I think I filed the PR from PyCharm to make an experiment, and I forgot to change the title to something meaningful. I think PyCharm turned the name of the branch Regarding the .sln file, I had the same issue on the other PR I opened on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for jumping on the comments and answering the questions! The code is simple and lookin' good :)
Thanks @alexrashed 🙂 @thrau when you have time, please give your approval, so I can unblock the other PR on |
@paolosalvatori I believe you mentioned the wrong person on your request. 🙃 |
Yep, wrong Thomas 🙂 I trusted GitHub when it proposed your alias instead of Thomas Rausch one 🙂 |
@paolosalvatori You already have the approval from my side (@thrau needs to approve still though). |
@alexrashed thanks for the heads up. I ran |
Test Results (amd64) - Integration, Bootstrap 5 files 5 suites 2h 22m 52s ⏱️ Results for commit e77b206. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Motivation
On Windows 11 + WSL, you have a layered setup:
The IP address of the Azurite container under
NetworkSettings.Networks.bridge.IPAddress
, let's say172.17.02
, is the IP address of your Azurite container within the Docker bridge network.This IP is only directly routable from other containers on the same Docker bridge network or from the Docker host itself (which, in this case, is the WSL 2 VM). Now, usually Docker on Windows is installed on a separate distro. You can check this by running the following command from the Windows command-prompt:
This should return something like this:
Windows Subsystem for Linux Distributions: Ubuntu-24.04 (Default) docker-desktop
As you can see, there are two distros:
Ubuntu-24.04 (Default)
running WSL, anddocker-desktop
. So far so good? Perfect. When running localhost in host mode in the WSL 2 distro's shell and not inside another Docker container, cannot use the IP address of the Azurite container. Full stop.So I extended the
localstack.config
class with a function to understand whether the host is running on WSL:Changes
I extended the
localstack.config
class with a function to understand whether the host is running on WSL:Testing
On WSL the
is_wsl()
returnstrue
.