Reputation: 282
Docker build will build and run the image, but during docker-compose I get the following error:
> .\docker-compose-Windows-x86_64.exe -f C:\t\tea\docker-compose.yml up
Building web
Traceback (most recent call last):
File "docker-compose", line 6, in <module>
File "compose\cli\main.py", line 71, in main
File "compose\cli\main.py", line 127, in perform_command
File "compose\cli\main.py", line 1039, in up
File "compose\cli\main.py", line 1035, in up
File "compose\project.py", line 465, in up
File "compose\service.py", line 327, in ensure_image_exists
File "compose\service.py", line 999, in build
File "site-packages\docker\api\build.py", line 149, in build
File "site-packages\docker\utils\build.py", line 15, in tar
File "site-packages\docker\utils\utils.py", line 100, in create_archive
File "tarfile.py", line 1802, in gettarinfo
FileNotFoundError: [WinError 3] The system cannot find the path specified:
'C:\\t\\tea\\src\\app\\accSettings\\account-settings-main\\components\\account-settings-catalog\\components\\account-settings-copy-catalog-main\\components\\account-settings-copy-catalog-destination\\components\\account-settings-copy-destination-table\\account-settings-copy-destination-table.component.html'
[18400] Failed to execute script docker-compose
> docker -v
Docker version 18.03.0-ce-rc1, build c160c73
> docker-compose -v
docker-compose version 1.19.0, build 9e633ef3
I've enabled Win32 long paths in my local group policy editor, but not having any luck solving this issue.
Here is the docker-compose.yml if it helps:
version: '3'
services:
web:
image: web
build:
context: .
dockerfile: Dockerfile
Upvotes: 8
Views: 3116
Reputation: 4230
This is a known issue under some circumstances with docker-compose. And, it is related to the MAX_PATH limitation of 260 characters on Windows.
Exerpt from the Microsoft docs on Maximum Path Length Limitation
In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters.
From reading up on this, it seems that the solution depends on your docker-compose version and Windows version. Here's a summary of the solutions that I have found:
Upgrade to docker-compose version 1.23.0 or beyond. There is a bugfix in the 1.23.0 release described as:
Fixed an issue where paths longer than 260 characters on Windows clients would cause docker-compose build to fail.
Enable NTFS long paths:
If you're using a version of Windows that does not provide access to Group Policy, you can edit the registry instead.
Install docker-compose via pip. This seems to have solve the issue for others that have come across this.
Expert from the docker-compose documentation:
For alpine, the following dependency packages are needed:
py-pip
,python-dev
,libffi-dev
,openssl-dev
,gcc
,libc-dev
, andmake
.Compose can be installed from pypi using
pip
. If you install usingpip
, we recommend that you use a virtualenv because many operating systems have python system packages that conflict with docker-compose dependencies. See the virtualenv tutorial to get started.pip install docker-compose
If you are not using virtualenv,
sudo pip install docker-compose
pip version 6.0 or greater is required.
Upvotes: 1