-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Windows Container: fs.realpathSync() is broken on shared volumes #8897
Comments
Does |
No, still the same. Can't see the
|
It seems that node can't find/load js files in the volume mount point.
|
Just to clarify, if someone else tries this and wants a temporary solution. This only occurs with Node.js 6.x and works fine with Node.js 4.6.0
|
This also affects opening files, eg. TLS certs mapped into a container through a volume. How can we proceed getting this fixed in LTS version of Node.js 6? |
How sure are you it's a node issue and not a docker-on-windows issue? Does the same node binary work outside of the container? |
@bnoordhuis I'm sure this is a Node.js problem. I've stripped down the problem as in #7044 to An internal directory works:
But a volume directory throws an exception:
Tested with both Node.js 6.9.1 and 7.0.0. |
cc @nodejs/platform-windows @nodejs/docker |
If this is really is a Node.js issue, can you edit the issue title and description with a purely Windows + Node.js test case? (without references to third-party tools) |
@seishun Updated both title and description with a walkthrough with only Win10+Docker |
If you want a better At the moment only this issue with the shared volume is a big difference to the node Linux container where you can work with shared folders from an editor/IDE with live coding from your host.
|
Just sent #9475 as a proposal to fix this issue. |
Here is a repro of what I think is the same issue, without docker. Windows 7 computer 1 (hostname REMOTE1):
Windows 10 computer 2:
|
@phestermcs In my example, the junction is all between local volumes on REMOTE1. It works; try it out yourself. |
@yoweiner My mistake. It misread thinking you were creating a junction from computer2 to REMOTE1, as opposed to accessing a junction on REMOTE1 from computer2. |
Is there a any progress on this? It's badly needed to work with docker compose and windows containers. |
Well, I at least started with this FROM microsoft/windowsservercore
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV chocolateyUseWindowsCompression false
RUN iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'));
RUN choco install -y nodejs -version 7.3.0
RUN choco install -y git -params "/GitAndUnixToolsOnPath"
RUN npm install --global --production windows-build-tools
RUN git clone https://github.com/nodejs/node.git
RUN cd node ; git pull ; \
$env:PATH += ';C:\Users\ContainerAdministrator\.windows-build-tools\python27' ; \
.\vcbuild.bat test nosign With that I also compiled a |
@VolleMelk docker run -d -p 8080:80 --name myrunningapp newimage |
I know this is not the issue being discussed here, but i wanted to point that although the latest windows version (Win10 April Update) and latests nano-insider builds solve this issue, i get stuck running npm or other node programs that use symbolic links on mounted volumes. Looks like symbolic lynking is not supported on mounted volumes, even running mklink manually does not work, returning an Access Denied error, see: |
Symlinks don't work on mounted volumes for containers with 'hyper-v'
isolation, but they do work for containers with 'process' isolation.
…On Fri, May 4, 2018 at 8:26 AM, Iñaki Elcoro ***@***.***> wrote:
I know this is not the issue being discussed here, but i wanted to point
that although the latest windows version (Win10 April Update) and latests
nano-insider builds solve this issue, i get stuck running npm or other node
programas that use symbolic links on mounted volumes.
Looks like symbolic lynking is not supported on mounted volumes, even
running mklink manually does not work, returning an Access Denied error,
see:
docker/for-win#1997 <docker/for-win#1997>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#8897 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABV6Uo-PJMVnIWbC8lk1nAtqZYm55kLpks5tvAKigaJpZM4KMAbs>
.
|
Good news, as @ielcoro mentioned. Mounted volumes work also with |
@jan11011977 That is dissapointing, one useful (maybe the most useful) use case for mounting volumes in Docker is for live editing during development and isolating development tools and dependency versions between projects, resulting in a clean host environment and making very easy to share the same development environment between team members. This affects tools like npm or git, and makes for us Docker unusable as development platform on Windows. |
When Windows Server 2016, Version 1803 arrives in a few days/weeks we should have new base images instead of the latest insider images. Then it should work with these base images. Looking forward to this. |
@StefanScherer Yes, the new base images are much better and will make Docker on Windows more approachable to a lot of people. Still us will be blocked by the symlink error on hyperv isolation mode aka "the only Windows 10 mode for containers" |
Hi, |
I finaly followed this solution.
Thanks |
My mistake, problem was related to PS's Execution Policies. I switched from Thank so much for your work and helping us. |
I am getting below error
Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.d__7 |
Running into this issue using microsoft/dotnet:4.7.2-sdk trying to use NPM |
So after reading this article is appears -- https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility It appears I can't use the version that's based off windowservercore-1803, while I could try it, it really wouldn't solve my problem to begin with. |
@Francommit if it‘s hard to have a Windows Server 1803 semi-annual release watch out for the next long-term supported Windows Server 2019 which will be available soon. |
Yeah unfortunately I'm going to have to wait for WS2019. Given I'm building node-packages in my container as a workaround I've just robocopied everything from a mount-point to a directory in the container then copied the artifacts back to the mount point. Not the most elegant solution or quickest but it proves my code will build for now!| EDIT: Why robocopy and not xcopy you might ask? Try and run xcopy in a Windows Server 2016 based windowsservercore image and see what happens 👎 |
@StefanScherer I still have this issue with your latest nanoserver nodejs image, so I assume this is still not resolved. Do you have a new workaround? The powershell-trick is not working, I still have the error from your first post. EDIT: Dockerfile
startup.bat
Would very much still like an actual fix or workaround :S EDIT EDIT: I'm an idiot, I didn't switch to the new volume... The workaround still works fine. |
@LennardF1989 The problem isn't fixed with the Windows 2016 base images. We have seen progress and fixes in the 1803 images, but people have to run Windows Server Core version 1803 which is quite rare. Now Windows Server 2019 / Windows 10 1809 Update is around the corner with two new Windows base images
And with these images bind mounting a folder into the container works fine in combination with Node.js. Edit: I also just tried to run a Windows 2016 based Node image on a Windows Server 2019 in HyperV isolation mode, but the problem still exists. This is because the Windows 2016 base image brings its old Windows kernel where the bind mount isn't fixed for Node.js. So the best experience will be only with the new 1809/ltsc2019 base images running on the latest Windows OS. |
I can confirm this is fixed in 1803 Core. Got it working today! |
Still having this issue with Windows 10!
Dockerfile
I'm trying to setup hot reloading with nodemon for a dev environment.
outputs
If I exclude the -v flag and docker run then it starts with no errors, but doesn't detect changes or restart on file saves. Github repo for code |
Thanks @bcowell for sharing your code. But This issue is about the problem with the "V1" of Windows containers beginning with Windows Server 2016 and Windows 10. The problem is solved beginning with Windows Server, version 1803 and Windows 10 1803 when you run the 1803 Windows images and Node.js inside. The Server 1803 isn't available for all users, but the Windows Server 2019 ("V2" of Windows containers :-) ) now is here. Embracing the new 1809 / ltsc2019 Windows images also solves this problem. The issue remains in the ltsc2016 images, but I think we can close this issue if people use the newer images soon. |
Thanks @StefanScherer you're right. |
Some of us would love for this to work in a ltc2016 container! @StefanScherer I'm yet to test this with the recent update to the ltc2016 base layers, will give it a try later in the week and report back. On a seim-unrelated note. I made a Windows Server 1803 version of my process using a shared volume mount that did part of a npm command, it was SLOWER overall than me performing a robocopy to a folder from the volume mount than performing the build on the volume mount directly. It appears to be an open issue on Docker for Windows community edition, just interesting to see it in practice. |
Is this problem still present? node v7 b488b19 (#3594) may have inadvently fixed it as a side effect, as Oh well, they decided the js readlink-and-stich-by-resolve version is superior. The native one is now fs.realpathSync.native().
path.resolve('nothere', '\\\\ContainerMappedDirectories\\6C4D3D41-7E32-4992-BC 03-44E1FAC23C0B') However, this breaks: D:\>mklink /D smbex \\?\notRealDevice\foo
D:\> dir /aL
2019/12/13 20:13 <SYMLINKD> smbex [\\?\notRealDevice\foo] fs.readlinkSync('D:\\smbex\\')
// '\\??\\notRealDevice\\foo'
path.resolve('notreal', fs.readlinkSync('D:\\smbex\\'))
// 'C:\\??\\notRealDevice\\foo' readlink somehow converted the |
This is still an issue in v14.0.0, can't use it in my GitLab CI pipeline... Some details: I need node.exe to compile the .ts files in .js files as part of a ASP.NET MVC project. I use the GitLab CI + Docker functionality to compile my project, but I have noticed that the .js files were missing. By digging in the issue I have discovered that I get the C:\ContainerMappedDirectories bug. I have tried some versions: 14.0.0, 10.19.0, 4.6.0 and 4.5.0, but no one will work with Docker with a mapped directory. |
@schifazl I was also having trouble with NodeJS in my |
I'm going to close this issue. |
The function
fs.realpathSync()
and/orpathModule._makeLong()
is broken using it on shared Docker volumes mapped from host into a Windows Container. It seems to interpret the junction point incorrectly which is an UNC path and interprets it asc:\ContainerMappedDirectories
.Steps to reproduce
You need Windows 10 Anniversary update with Containers feature and Docker installed. Or an Windows Server 2016 with Containers feature and Docker installed, eg. an Azure VM.
Create a test directory with a minimal
Dockerfile
to just putnode.exe
into a Windows container.This is the content of the
Dockerfile
Now build a Docker image eg. for Node.js 4.6.1 using a build argument:
We can check that the binary works inside the Windows container by showing the version
Now check that fs.realpathSync() works with an existing directory inside the container.
OK. Now we mount the current directory as shared volume into the container and have a look at it with the dir command:
OK, the directory
C:\test
is there, but you can see that it is a symlink to an UNC path. Let's check that this directory is accessible.OK, we can see the Dockerfile from the host. So let's now check fs.realpathSync with that directory.
Boom! As you can see the UNC path is misinterpreted as
c:\ContainerMappedDirectories
and then of course this directory does not exist inside the Windows container.This error breaks eg. using
npm install
on such a shared volume or even running simple Node.js code from it.Let's create a small
hello.js
, map the current folder into a container and try to run it.When we copy the file from the shared volume into a local directory of the Windows container Node.exe is able to run it:
Another problem of this bug is that running
npm install
also does not work in a shared volume.The text was updated successfully, but these errors were encountered: