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

wslpath -u resolves to Docker WSL bind-mount path instead of expected Ubuntu WSL path in a multi-WSL environment #11555

Closed
1 of 2 tasks
gsusI opened this issue May 5, 2024 · 3 comments

Comments

@gsusI
Copy link

gsusI commented May 5, 2024

Windows Version

Microsoft Windows [Version 10.0.22631.3527]

WSL Version

2.2.1.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.150.1-microsoft-standard-WSL2

Distro Version

Ubuntu 22.04

Other Software

Docker Desktop 4.29.0 (145265) with WSL2 containers

Repro Steps

  1. Navigate to the Relevant Directory:

    • Open a terminal and navigate to the directory where the Docker file is located.
  2. Run the Docker File:

    • Ensure Docker Desktop is running.
    • Execute the Dockerfile by running the appropriate Docker command (e.g., docker build -t myimage .).
    ARG PHP_VERSION=7.4
    FROM php:${PHP_VERSION}-cli
    
    # Install necessary packages
    RUN apt-get update && apt-get install -y git unzip
    
    # Install Composer
    RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
    
    # Set the working directory inside the container
    WORKDIR /app
  3. Close All Terminals:

    • After the Docker operation completes, close all open terminal windows to ensure a fresh environment for the next steps.
  4. Open PowerShell (pwsh):

    • Open PowerShell on your Windows system.
  5. Navigate to the Affected Directory Using WSL Command:

    • In PowerShell, navigate to the affected directory using the command:
      wsl
      
    • This command opens the directory within the Docker bind-mount context due to the existing issue.
  6. Manually Change Directory to the Affected Directory:

    • Within the WSL environment that opened, manually change to the affected directory using cd command to ensure you are in the correct context.
  7. Verify Directory Path with pwd:

    • Run pwd to confirm that the terminal is in the correct directory. This should return the expected directory path.
  8. Run wslpath -u .:

    • Still in the same directory, run the command:
      wslpath -u .
      
    • Observe that the output incorrectly points to the Docker bind-mount directory instead of reflecting the output of pwd.

Expected Behavior

  • wslpath -u . result from wsl should match pwd.
  • wsl from PowerShell should open WSL in the current path as it is, not in the Docker bind-mount.

Actual Behavior

wslpath -u . incorrectly resolves to a Docker bind-mount path instead of matching the pwd

Diagnostic Logs

No response

Copy link

github-actions bot commented May 5, 2024

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@gsusI
Copy link
Author

gsusI commented Jul 22, 2024

This ticket should not have been closed

Marking a task as #needs-author-feedback without asking for feedback is not acceptable.

Especially since you've closed a lot of duplicated tasks referring to this one.

@gsusI
Copy link
Author

gsusI commented Jul 22, 2024

Solution: docker/for-win#13947 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant