compose: [BUG] Path Evaluation Error on Windows

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

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

issues has been fixed in Bake

@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"
    }
  }
}

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