Compose: building local dockerfile from compose, hits windows max path length error

Created on 29 Nov 2015  路  13Comments  路  Source: docker/compose

I can build and run containers on windows just fine. But when including the build: . in my docker-compose.yml, the build step fails as it hits the max path error that was fixed in docker.

Anyone else encounter the same issue have any workarounds?

grouwindows-client

Most helpful comment

Adding node_modules to .dockerignore fixes this for many people.

All 13 comments

What is this max path error? Do you have a link to the docker issue and the PR that fixed it?

If you have a way to reproduce the error, that would be good too.

max path length in Windows is 260 chars https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx. Prefixing them with \\?\ enables long paths. I should look for the PR in docker that fixed it

Full stack trace from #3026

$ docker-compose.exe build
Building web
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "C:\projects\compose\compose\cli\main.py", line 55, in main
  File "C:\projects\compose\compose\cli\docopt_command.py", line 23, in sys_dispatch
  File "C:\projects\compose\compose\cli\docopt_command.py", line 26, in dispatch
  File "C:\projects\compose\compose\cli\main.py", line 174, in perform_command
  File "C:\projects\compose\compose\cli\main.py", line 195, in build
  File "C:\projects\compose\compose\project.py", line 246, in build
  File "C:\projects\compose\compose\service.py", line 678, in build
  File "c:\projects\compose\venv\lib\site-packages\docker\api\build.py", line 49, in build
  File "c:\projects\compose\venv\lib\site-packages\docker\utils\utils.py", line 103, in tar
  File "c:\python27-x64\Lib\tarfile.py", line 2006, in add
  File "c:\python27-x64\Lib\tarfile.py", line 1878, in gettarinfo
WindowsError: [Error 3] The system cannot find the path specified: 'C:\\Users\\ShapeR\\PycharmProjects\\esanum-ng\\src\\frontend\\library\\bower_components\\angular-api-sdk\\node_modules\\grunt-protractor-runner\\node_modules\\protractor\\node_modules\\accessibility-developer-tools\\src\\audits\\its\\FocusableElementNotVisibleAndNotAriaHidden.js'
docker-compose returned -1

Any chances it getting fixed soon?

This basically stop window user to work on nodejs project cause they have long path dependencies..

A work around for this issue is to remove the packages, which cause the error, from the node_modules folder. The contents of node_modules shouldn't be used in the container.

Adding node_modules to .dockerignore fixes this for many people.

@jaygorrell that's not solution because node_modules content is required for IDE and development on localhost

@gordienkotolik That's true. But what about compiled dependencies / C bindings? Shouldn't these installed/compiled for Linux inside the Linux container with RUN npm install?

But I agree, using docker-compose.exe should also work for Windows containers where you can just add the node_modules tree.

@gordienkotolik For local development, these are generally bind mounted into the container which works fine, hence the 'many people'. You're right though if you truly need them built into the image locally, this won't work.

Hi! I ran in the exact same issue. When I build the container on Windows, the following error message appears and the container is not built.

WindowsError: [Error 3] The system cannot find the path specified: ...

I saw the links provided by @StefanScherer with proposed fixes. But I don't understand how I can get my environment running.

Could anyone please give me a hint?

@kristinbaumann The fixes are in the Windows Docker Engine and work if you eg. run npm install inside a Windows Container to build an Windows Docker image.

It's just to get an idea what has to be done in the windows version of compose to use the UNC file names. But hey, Microsoft has announced to get rid of that limit, but that works only for latest Windows 10 + some customizations. http://mspoweruser.com/ntfs-260-character-windows-10/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saulshanabrook picture saulshanabrook  路  3Comments

DhairyashilBhosale picture DhairyashilBhosale  路  3Comments

dimsav picture dimsav  路  3Comments

foxx picture foxx  路  3Comments

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  路  3Comments