Repository navigation
[BUG] Compose won't find Dockerfile when in a symlinked folder #12799
Copy link
Copy link
Closed as not planned
Description
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
- 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.
- 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.
- Create a Compose file. The name doesn't matters, I could reproduce the bug whenever it was named
compose.yamlordocker-compose.ymlfor example. Make sure it points to the Dockerfile using thebuild: .directive. - Go to the real directory and try the following commands:
docker build -t test .--> passdocker compose up -d --build--> pass
- Down the test compose project (optional, haven't tried without this step)
- 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
Reactions are currently unavailable
Activity
ndeloof commentedon May 5, 2025
Can't reproduce
ndeloof commentedon May 5, 2025
maybe specific to WSL when symlink points to a distinct windows drive ?
ndeloof commentedon May 5, 2025
Can you please try running with
COMPOSE_BAKE=truevariable set ?GeekCornerGH commentedon May 5, 2025
Hi @ndeloof this might indeed be a Windows only problem.
With bake, it returns
However this issue happens also when in the real folder
Edit: formatting
ndeloof commentedon May 5, 2025
Ouch. Unrelated to this issue then, but could you please run
COMPOSE_BAKE=true docker compose --verbose buildto capture the error and let me investigate ?GeekCornerGH commentedon May 5, 2025
Sure thing @ndeloof. From the real folder:
ndeloof commentedon May 5, 2025
this is actually #12669, fixed by docker/buildx#3141
GeekCornerGH commentedon May 5, 2025
Glad to hear! What about my initial issue tho?
GeekCornerGH commentedon May 5, 2025
Also dumping this log with
COMPOSE_BAKEset to true, in the symlinked folder too.ndeloof commentedon May 6, 2025
is
C:\Users\Admin\dev\test-dockerthe actual path to your build context or the symlink location ? Can you confirmdocker build .is successful when ran from this folder ?GeekCornerGH commentedon May 6, 2025
To be clear, C: is the symlink.
docker build .indeed works from here.tmarvin-repay commentedon May 30, 2025
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.
GeekCornerGH commentedon Jun 4, 2025
I meant junctionned instead symlinked indeed
ndeloof commentedon Jun 4, 2025
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 replicatedgithub-actions commentedon Nov 2, 2025
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.
GeekCornerGH commentedon Nov 3, 2025
Any update on this bug report?
stale commentedon Nov 3, 2025
This issue has been automatically marked as not stale anymore due to the recent activity.
JeffreyMercado commentedon Feb 13, 2026
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.
github-actions commentedon Jul 15, 2026
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.
GeekCornerGH commentedon Aug 19, 2026
@ndeloof may you reopen the issue?