Skip to content

[BUG] Compose won't find Dockerfile when in a symlinked folder #12799

Closed as not planned

Description

@GeekCornerGH

Description

Expected:
Compose to build the image from the Dockerfile

Current:

[+] Building 0.0s (0/0)           docker:desktop-linux
resolve : The system cannot find the path specified.

Steps To Reproduce

  1. Create a folder, then make a symlink pointing to that folder somewhere else. In my case the actual folder was on a separate drive, where the symlink was on the main drive.
  2. Create a Dockerfile. You don't to do specific tasks. We just need to get it to be valid. For what I know it might be a placeholder redirecting to another image.
  3. Create a Compose file. The name doesn't matters, I could reproduce the bug whenever it was named compose.yaml or docker-compose.yml for example. Make sure it points to the Dockerfile using the build: . directive.
  4. Go to the real directory and try the following commands:
    • docker build -t test . --> pass
    • docker compose up -d --build --> pass
  5. Down the test compose project (optional, haven't tried without this step)
  6. Go to the symlinked directory and try the same commands:
    • docker build -t test . --> pass`
    • docker compose up -d --build --> fail

Compose Version

Docker Compose version v2.35.1-desktop.1

Docker Environment

Client:
 Version:    28.1.1
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v1.1.7
    Path:     C:\Program Files\Docker\cli-plugins\docker-ai.exe
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.23.0-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  cloud: Docker Cloud (Docker Inc.)
    Version:  v0.3.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-cloud.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.35.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 (Docker Inc.)
    Version:  v0.1.8
    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
  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
  mcp: Docker MCP Plugin (Docker Inc.)
    Version:  dev
    Path:     C:\Program Files\Docker\cli-plugins\docker-mcp.exe
  model: Docker Model Runner (Docker Inc.)
    Version:  v0.1.11
    Path:     C:\Program Files\Docker\cli-plugins\docker-model.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.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 2
  Running: 2
  Paused: 0
  Stopped: 0
 Images: 2
 Server Version: 28.1.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: 05044ec0a9a75232cad458027ca83437aae3f4da
 runc version: v1.2.5-0-g59923ef
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
 Kernel Version: 5.15.167.4-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 15.5GiB
 Name: docker-desktop
 ID: 0204b8f6-71e9-440a-9bb6-a5de617944c2
 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: DOCKER_INSECURE_NO_IPTABLES_RAW is set
WARNING: daemon is not using the default seccomp profile

Anything else?

Took me long enough to figure this out, and it surprised me that docker build worked, but not docker compose

Activity

  1. ndeloof commented on May 5, 2025

    @ndeloof
    Contributor

    Can't reproduce

    $  ls -l test
    total 32
    -rw-r--r--  1 nicolas  staff   30  5 mai 08:34 compose.yaml
    -rw-r--r--  1 nicolas  staff   12 29 avr 09:20 Dockerfile
    $ ls -l link
    lrwxr-xr-x  1 nicolas  staff  4  5 mai 08:35 link -> test
    $ cd link
    $ docker compose up -d --build
    ...
     => [box] resolving provenance for metadata file                                                                                                                                         0.0s
    [+] Running 3/3
     ✔ test                   Built   
    
  2. ndeloof commented on May 5, 2025

    @ndeloof
    Contributor

    maybe specific to WSL when symlink points to a distinct windows drive ?

  3. ndeloof commented on May 5, 2025

    @ndeloof
    Contributor

    Can you please try running with COMPOSE_BAKE=true variable set ?

  4. GeekCornerGH commented on May 5, 2025

    @GeekCornerGH
    Author

    Hi @ndeloof this might indeed be a Windows only problem.
    With bake, it returns

    => [internal] load local bake definition      0.0s
    failed to execute bake: exit status 1
    

    However this issue happens also when in the real folder

    Edit: formatting

  5. ndeloof commented on May 5, 2025

    @ndeloof
    Contributor

    However this issue happens also when in the real folder

    Ouch. Unrelated to this issue then, but could you please run COMPOSE_BAKE=true docker compose --verbose build to capture the error and let me investigate ?

  6. GeekCornerGH commented on May 5, 2025

    @GeekCornerGH
    Author

    Sure thing @ndeloof. From the real folder:

    time="2025-05-05T15:38:14+02:00" level=debug msg="Enabled Docker Desktop integration (experimental) @ npipe://\\\\.\\pipe\\docker_cli"
    time="2025-05-05T15:38:14+02:00" level=debug msg="bake build config:\n{\n  \"group\": {\n    \"default\": {\n      \"targets\": [\n        \"alpine\"\n      ]\n    }\n  },\n  \"target\": {\n    \"alpine\": {\n      \"context\": \"D:\\\\dev\\\\test-docker\",\n      \"dockerfile\": \"D:\\\\dev\\\\test-docker\\\\Dockerfile\",\n      \"tags\": [\n        \"test-docker-alpine\"\n      ],\n      \"output\": [\n        \"type=docker,load=true,push=false\"\n      ]\n    }\n  }\n}"
    time="2025-05-05T15:38:14+02:00" level=debug msg="Executing bake with args: [bake --file - --progress rawjson --metadata-file C:\\Users\\Dev\\AppData\\Local\\Temp\\compose980585222 --allow fs.read=D:\\dev\\test-docker]"
    time="2025-05-05T15:38:14+02:00" level=trace msg="Plugin server listening on @docker_cli_2b04244286d06b447f0e6543342508f7"
    [+] Building 0.0s (1/1) FINISHED
     => [internal] load local bake definitions                                                                         0.1s
     => => reading from stdin 354B                                                                                     0.1s
    time="2025-05-05T15:38:14+02:00" level=debug msg="otel error" error="<nil>"
    time="2025-05-05T15:38:14+02:00" level=debug msg="otel error" error="<nil>"
    failed to evaluate path "D:\\dev\\test-docker/D:\\dev\\test-docker\\Dockerfile": CreateFile D:\dev\test-docker\D:: The filename, directory name, or volume label syntax is incorrect.
    
  7. ndeloof commented on May 5, 2025

    @ndeloof
    Contributor

    failed to evaluate path "D:\dev\test-docker/D:\dev\test-docker\Dockerfile

    this is actually #12669, fixed by docker/buildx#3141

  8. GeekCornerGH commented on May 5, 2025

    @GeekCornerGH
    Author

    this is actually fixed

    Glad to hear! What about my initial issue tho?

  9. GeekCornerGH commented on May 5, 2025

    @GeekCornerGH
    Author

    Also dumping this log with COMPOSE_BAKE set to true, in the symlinked folder too.

    time="2025-05-05T20:33:30+02:00" level=debug msg="Enabled Docker Desktop integration (experimental) @ npipe://\\\\.\\pipe\\docker_cli"
    time="2025-05-05T20:33:30+02:00" level=debug msg="bake build config:\n{\n  \"group\": {\n    \"default\": {\n      \"targets\": [\n        \"alpine\"\n      ]\n    }\n  },\n  \"target\": {\n    \"alpine\": {\n      \"context\": \"C:\\\\Users\\\\Admin\\\\dev\\\\test-docker\",\n      \"dockerfile\": \"C:\\\\Users\\\\Admin\\\\dev\\\\test-docker\\\\Dockerfile\",\n      \"tags\": [\n        \"test-docker-alpine\"\n      ],\n      \"output\": [\n        \"type=docker,load=true,push=false\"\n      ]\n    }\n  }\n}"
    time="2025-05-05T20:33:30+02:00" level=debug msg="Executing bake with args: [bake --file - --progress rawjson --metadata-file C:\\Users\\Admin\\AppData\\Local\\Temp\\compose1458393954 --allow fs.read=C:\\Users\\Admin\\dev\\test-docker]"
    time="2025-05-05T20:33:30+02:00" level=trace msg="Plugin server listening on @docker_cli_2d7e296de89e2638c729dbbe3503a2c4"
    [+] Building 0.0s (1/1) FINISHED                                                                                                                     
     => [internal] load local bake definitions                                                                                                      0.1s
     => => reading from stdin 388B                                                                                                                  0.1s 
    time="2025-05-05T20:33:30+02:00" level=debug msg="otel error" error="<nil>"
    time="2025-05-05T20:33:30+02:00" level=debug msg="otel error" error="<nil>"
    failed to evaluate path "C:\\Users\\Admin\\dev\\test-docker": The system cannot find the path specified.
    
  10. ndeloof commented on May 6, 2025

    @ndeloof
    Contributor

    is C:\Users\Admin\dev\test-docker the actual path to your build context or the symlink location ? Can you confirm docker build . is successful when ran from this folder ?

  11. GeekCornerGH commented on May 6, 2025

    @GeekCornerGH
    Author

    To be clear, C: is the symlink. docker build . indeed works from here.

  12. tmarvin-repay commented on May 30, 2025

    @tmarvin-repay

    I am also having this issue but with a junctioned* folder instead of a symlinked one.

    The docker compose process works when done from the main/original folder but does not work with the junctioned* version.

  13. GeekCornerGH commented on Jun 4, 2025

    @GeekCornerGH
    Author

    I meant junctionned instead symlinked indeed

  14. ndeloof commented on Jun 4, 2025

    @ndeloof
    Contributor

    probably same cause as https://github.com/docker/compose/issues/12891
    docker build . has some dedicated code to manage various corner cases that needs to be replicated

  15. github-actions commented on Nov 2, 2025

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  16. GeekCornerGH commented on Nov 3, 2025

    @GeekCornerGH
    Author

    Any update on this bug report?

  17. stale commented on Nov 3, 2025

    @stale

    This issue has been automatically marked as not stale anymore due to the recent activity.

  18. JeffreyMercado commented on Feb 13, 2026

    @JeffreyMercado

    I had recently hit this issue myself and posted about it in StackOverflow.

    Had my project on a dev drive, but accessed it through directory mounted volumes. Couldn't docker compose build when working through the mounted volume.

  19. github-actions commented on Jul 15, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  20. GeekCornerGH commented on Aug 19, 2026

    @GeekCornerGH
    Author

    @ndeloof may you reopen the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions