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

WorkingDir of subdir of a volume mount is not found by Python's os.getcwd() #5698

Closed
2 tasks done
adamkerz opened this issue Feb 5, 2020 · 7 comments
Closed
2 tasks done

Comments

@adamkerz
Copy link

adamkerz commented Feb 5, 2020

  • I have tried with the latest version of my channel (Stable or Edge)
  • I have uploaded Diagnostics
  • Diagnostics ID: BCFAE496-38CD-4C65-874D-E51FB949BA6B/20200205045509

Expected behavior

Running python -c "import os; os.getcwd()" should succeed

Actual behavior

Traceback (most recent call last):
  File "<string>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory

Same problem when running os.getcwd() from within a script.

Information

I am running docker desktop 2.2.0.0 (42247), engine 19.03.5
It is not present in docker desktop 2.1.0.3, engine 19.03.2
Windows: 1909 (18363.628), not virtualised

Steps to reproduce the behavior

Dockerfile

FROM python:3.6.8-stretch
WORKDIR /my_dir/working

Run in cmd:

set CWD_BUG_DIR=C:\cwd_1_bug\my_dir
mkdir %CWD_BUG_DIR%
mkdir %CWD_BUG_DIR%\working

docker build --no-cache -t docker_cwd_bug .
# bug
docker run -it -v %CWD_BUG_DIR%:/my_dir docker_cwd_bug python -c "import os; os.getcwd()"
# ok - mounting the actual working dir appears to avoid the issue
docker run -it -v %CWD_BUG_DIR%\working:/my_dir/working docker_cwd_bug python -c "import os; os.getcwd()"
@mat007
Copy link
Member

mat007 commented Feb 5, 2020

I think this might be a variant of #5550 ?

@mat007
Copy link
Member

mat007 commented Feb 5, 2020

I wasn’t able to reproduce it by the way, does it occur every time for you?
Also I’m running this new private which fixes some related issues, would you mind trying it as well?
It’s https://download-stage.docker.com/win/stable/42579/Docker%20Desktop%20Installer.exe

@adamkerz
Copy link
Author

adamkerz commented Feb 5, 2020

Yep, every time. OK, I'll have a go of the private version tomorrow.

@vchirikov
Copy link

vchirikov commented Feb 5, 2020

@mat007 thanks, the issue with fs is fixed.


edited:
Not completely, sometimes it was repeated again. I will downgrade docker..

@AlJohri
Copy link

AlJohri commented Feb 6, 2020

I briefly experienced this same error in Docker for Mac 2.2.0.0. I discovered it when random things with Python's pathlib were failing such as running .resolve() or .stem. The root cause was that python's os.getcwd() was returning file not found error. I'm using vscode with a docker container which mounts the current file system directory.

Closing vscode and starting again somehow resolved the error for now?

@adamkerz
Copy link
Author

adamkerz commented Feb 13, 2020

This appears to be fixed for me in v2.2.0.3 (42716) - thank you very much all devs!

@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 13, 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

5 participants