Skip to content

[BUG] Path Evaluation Error on Windows #12669

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

Closed
adelynx opened this issue Mar 25, 2025 · 13 comments · Fixed by docker/buildx#3141
Closed

[BUG] Path Evaluation Error on Windows #12669

adelynx opened this issue Mar 25, 2025 · 13 comments · Fixed by docker/buildx#3141
Labels

Comments

@adelynx
Copy link

adelynx commented Mar 25, 2025

Description

I encountered a path evaluation error while trying to build my Docker image on Windows using the following command:

docker compose up --build

Error Message:

failed to evaluate path "C:\\Users\\xxx\\Documents\\Projects\\my-app/C:\\Users\\xxx\\Documents\\Projects\\my-app\\docker\\web\\Dockerfile": CreateFile C:\Users\xxx\Documents\Projects\my-app\C:: The filename, directory name, or volume label syntax is incorrect.

Steps To Reproduce

I encountered a path evaluation error while trying to build my Docker image on Windows using the following command:

docker compose up --build

Error Message:

failed to evaluate path "C:\\Users\\xxx\\Documents\\Projects\\my-app/C:\\Users\\xxx\\Documents\\Projects\\my-app\\docker\\web\\Dockerfile": CreateFile C:\Users\xxx\Documents\Projects\my-app\C:: The filename, directory name, or volume label syntax is incorrect.

Environment:
• OS: Windows 11
• Docker Version: 4.39.0 (184744)
• Docker Compose Version: v2.33.1-desktop.1
• Podman

Expected Behavior

Docker should correctly evaluate and resolve the path to the Dockerfile without errors.

Actual Behavior

Docker is appending an extra C: in the path, resulting in an invalid path that causes the build to fail.

Steps to Reproduce:
1. Run docker compose up --build in the project directory.
2. Observe the error message.

Additional Information:
• I tried running the same configuration using Podman and it worked without any issues.
• I tried running the same configuration using Docker v4.27.2 and it worked without any issues.

Attempted Solutions:
• Verified that the docker-compose.yml contains the correct path to the Dockerfile.
• Tried using relative and absolute paths, but the error persists.
• Tested with Podman, which worked correctly.

Compose Version

docker compose version
Docker Compose version v2.33.1-desktop.1

docker-compose version
Docker Compose version v2.33.1-desktop.1

Docker Environment

Client:
 Version:    28.0.1
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v0.9.8
    Path:     C:\Users\xxx\.docker\cli-plugins\docker-ai.exe
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.21.1-desktop.2
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.33.1-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.38
    Path:     C:\Program Files\Docker\cli-plugins\docker-debug.exe
  desktop: Docker Desktop commands (Beta) (Docker Inc.)
    Version:  v0.1.5
    Path:     C:\Program Files\Docker\cli-plugins\docker-desktop.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.27
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.5
    Path:     C:\Program Files\Docker\cli-plugins\docker-feedback.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scout: Docker Scout (Docker Inc.)
    Version:  v1.17.0
    Path:     C:\Users\xxx\.docker\cli-plugins\docker-scout.exe

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 4
 Server Version: 28.0.1
 Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 nvidia runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc version: v1.2.4-0-g6c52b3f
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
 Kernel Version: 5.15.133.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 7.636GiB
 Name: docker-desktop
 ID: 20e8681b-23d8-405d-8eae-9eb70f6798ca
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Labels:
  com.docker.desktop.address=npipe://\\.\pipe\docker_cli
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile

Anything else?

Image

@ndeloof
Copy link
Contributor

ndeloof commented Mar 25, 2025

Can you please share your compose file (at least, the build section) so I better understand what can cause this bug ?

@ndeloof
Copy link
Contributor

ndeloof commented Mar 25, 2025

tested with latest release (v2.34.0) and can't reproduce using this basic reproduction example:

services:
  test:
    build: .

@adelynx
Copy link
Author

adelynx commented Mar 25, 2025

@ndeloof

services:
  web:
    build:
      context: .
      dockerfile: docker/web/Dockerfile

@adelynx
Copy link
Author

adelynx commented Mar 25, 2025

@ndeloof I downloaded the latest release of Docker Compose (v2.34.0), but it didn’t work and produced the same error. I then randomly downgraded to Docker Compose v2.30.3, which worked fine.

Image

@guillaume86
Copy link

I have a similar issue when trying the COMPOSE_BAKE=true option.

@brianly1003
Copy link

I have a similar issue when trying the COMPOSE_BAKE=true option.

I got the same issue once setting COMPOSE_BAKE=true

@ndeloof
Copy link
Contributor

ndeloof commented Apr 8, 2025

Would you have a chance to give #12721 a try ?

  1. checkout my PR
  2. make install to build and install compose binary
  3. run docker compose build the same way you used to
  4. let me know this fix your issue, or same failure

@ndeloof
Copy link
Contributor

ndeloof commented Apr 8, 2025

A point I don't get here, is that is seems compose is considering the dockerfile path C:\\Users\\xxx\\Documents\\Projects\\my-app\\docker\\web\\Dockerfile as relative, and prepends the context path C:\\Users\\xxx\\Documents\\Projects\\my-app/, but uses / separator which doesn't make sense as it's running on windows. Maybe are you running a Linux version of compose within a WSL unix shell ?

@trulysinclair
Copy link

Using Bake (COMPOSE_BAKE=true) causes the path issues. Disabling made things work again.

@ndeloof
Copy link
Contributor

ndeloof commented Apr 10, 2025

@trulysinclair can you please run docker buildx bake -f compose.yaml and let me know same error is reported

@JvdsReform
Copy link

JvdsReform commented Apr 12, 2025

@ndeloof

I have the same problem:

docker compose up --build

does NOT work with COMPOSE_BAKE=true enabled. It does work with the standard docker buildx bake command.

Bake config output from docker compose delegating to bake:

{
  "group": {
    "default": {
      "targets": [
        "ai-module",
        "frontend",
        "api"
      ]
    }
  },
  "target": {
    "ai-module": {
      "context": "C:/Users/jelle/Desktop/reform/github/ai-module-prod",
      "dockerfile": "C:\\Users\\jelle\\Desktop\\reform\\github\\ai-module-prod\\Dockerfile",
      "args": {
        "NAME": "agents",
        "TYPE": "services"
      },
      "tags": [
        "reform-ai-module"
      ],
      "ssh": [
        "wolfkey=C:/Users/jelle/.ssh/wolfkey"
      ],
      "no-cache": true,
      "output": [
        "type=docker,load=true,push=false"
      ]
    },
    "api": {
      "context": "C:/Users/jelle/Desktop/reform/github/api",
      "dockerfile": "C:\\Users\\jelle\\Desktop\\reform\\github\\api\\Dockerfile",
      "tags": [
        "reform-api"
      ],
      "no-cache": true,
      "output": [
        "type=docker,load=true,push=false"
      ]
    },
    "frontend": {
      "context": "C:/Users/jelle/Desktop/reform/github/frontend",
      "dockerfile": "C:\\Users\\jelle\\Desktop\\reform\\github\\frontend\\Dockerfile",
      "tags": [
        "reform-frontend"
      ],
      "no-cache": true,
      "output": [
        "type=docker,load=true,push=false"
      ]
    }
  }
}

Bake config output from buildx bake:

{
  "group": {
    "default": {
      "targets": [
        "ai-module",
        "api",
        "frontend"
      ]
    }
  },
  "target": {
    "ai-module": {
      "context": "C:/Users/jelle/Desktop/reform/github/ai-module-prod",
      "dockerfile": "Dockerfile",
      "args": {
        "NAME": "agents",
        "TYPE": "services"
      },
      "ssh": [
        {
          "id": "wolfkey",
          "paths": [
            "C:/Users/jelle/.ssh/wolfkey"
          ]
        }
      ]
    },
    "api": {
      "context": "C:/Users/jelle/Desktop/reform/github/api",
      "dockerfile": "Dockerfile"
    },
    "frontend": {
      "context": "C:/Users/jelle/Desktop/reform/github/frontend",
      "dockerfile": "Dockerfile"
    }
  }
}

@elieobeid7
Copy link

elieobeid7 commented Apr 21, 2025

I can confirm, yesterday I enabled these options trying to speed up the build and the problem occured

DOCKER_BUILDKIT=1
COMPOSE_DOCKER_CLI_BUILD=1
COMPOSE_BAKE=1

I'm using Windows 11 latest update, and WSL2 (Ubuntu 24.04.1 LTS) Docker integration. I'm using the latest Docker desktop version.

Today, I removed these options, and the problem was solved. And it turns out that the build stage for my images is faster by about 40 seconds without these options anyway.

This issue occures when trying to build docker images via powershell and not via WSL2. If you use WSL2 linux bash shell to build the docker images, you won't face this issue.

@ndeloof
Copy link
Contributor

ndeloof commented Apr 22, 2025

issues has been fixed in Bake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants