compose: WINDOWS: unable to build simple docker-compose.yml with changed context

Description of the issue

My docker-compose.yml:

version: '3'

services:
  app:
      image: 'registry.1dal.loc/kek/mekekeke'
      build:
          context: .
          dockerfile: ./docker/app/Dockerfile

Context information (for bug reports)

PS C:\Users\1dal\devel\kek\mekekeke> docker-compose up
Building app
Traceback (most recent call last):
  File "site-packages\docker\utils\utils.py", line 117, in create_archive
OSError: [Errno 22] Invalid argument: 'C:\Users\\1dal\\devel\\kek\\mekekeke\\bin\\console'

During handling of the above exception, another exception occurred:

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 998, in build
  File "site-packages\docker\api\build.py", line 150, in build
  File "site-packages\docker\utils\build.py", line 15, in tar
  File "site-packages\docker\utils\utils.py", line 121, in create_archive
OSError: Can not read file in context: C:\Users\\1dal\\devel\\kek\\mekekeke\\bin\\console
[4756] Failed to execute script docker-compose

Output of “docker-compose version”

docker-compose version 1.20.1, build 5d8c71b2

Output of “docker version”

Docker version 18.03.0-ce, build 0520e24

Output of “docker-compose config”

services:
  app:
    build:
      context: C:\Users\1dal\devel\kek\mekekeke
      dockerfile: ./docker/app/Dockerfile
    image: 'registry.1dal.loc/kek/mekekeke'
version: '3.0'

Steps to reproduce the issue

  1. docker-compose up

Expected result

Builded, container up.

Additional information

Windows 10, Powershell/cmd.exe (same result)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20

Most upvoted comments

I was having the same issue after upgrading to WSL 2 on Windows. Just removed node_modules and vendor folders (JS and PHP dependencies) and recreated them through their respective commands.

It’s probably some kind of symlink issue, you can check that by navingating into the node_modules\.bin folder and listing its contents.

I had this very issue and it turned out to be the node_modules directory. I created a .dockerignore file and added this https://github.com/garygitton/dockerignore/blob/master/Node.dockerignore

I have a file with 0 byte, and this is also cause a problem.

@setlec @quickstar

one solution is to go to the ‘public’ folder and delete the ‘storage’ file. this file is a Linux native symlinks

I was having the same issue after upgrading to WSL 2 on Windows. Just removed node_modules and vendor folders (JS and PHP dependencies) and recreated them through their respective commands.

It’s probably some kind of symlink issue, you can check that by navingating into the node_modules\.bin folder and listing its contents.

I have the same problem after upgrading to WSL 2, but isn’t there a fix for this beside removing and reinstalling composer and npm packages over and over again?

Restart docker resolve my problem 😌