rancher-desktop: Docker compose in Rancher Desktop doesn't mount files
Actual Behavior
Docker run and docker compose in Docker Desktop mounts all volumes correctly. I switched to Rancher Desktop, and used the exact same compose file. The docker run is working correctly, and the docker compose is NOT mounting directories/files correctly.
I created the following test to prove it:
Directory structure:
C:\temp>tree /f
Folder PATH listing for volume Sys
Volume serial number is D2DF-CD16
C:.
│ docker-compose.yml
└───postgresql
10-create_users.sh
20-create_dbs.sh
docker-compose.yml contents:
version: "3.7"
services:
test1:
image: ubuntu:latest
container_name: ubuntu-test
hostname: ubuntu-test
command: ["ls","-la","/db"]
#command: ["sleep","infinity"]
volumes:
- c:\temp\postgresql:/db:ro
Output from the docker run command:
C:\temp>docker run -it -v c:\temp\postgresql:/db:ro --name ubuntu-test ubuntu ls -la /db
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
405f018f9d1d: Pull complete
Digest: sha256:b6b83d3c331794420340093eb706a6f152d9c1fa51b262d9bf34594887c2c7ac
Status: Downloaded newer image for ubuntu:latest
total 8
drwxrwxrwx 1 root root 4096 Jun 21 11:07 .
drwxr-xr-x 1 root root 4096 Jun 24 10:56 ..
-rwxrwxrwx 1 root root 520 Jun 21 11:07 10-create_users.sh
-rwxrwxrwx 1 root root 420 Jun 21 11:07 20-create_dbs.sh
Output from the docker compose run command:
C:\temp>docker compose run test1
total 8
drwxr-xr-x 2 root root 4096 Jun 24 10:59 .
drwxr-xr-x 1 root root 4096 Jun 24 10:59 ..
Diff from inspect on both( docker run = left, docker compose run = right ):
37c37
< "/mnt/c/temp/postgresql:/db:ro"
---
> "/c/temp/postgresql:/db:ro"
84c84
< "BlkioWeightDevice": [],
---
> "BlkioWeightDevice": null,
95c95
< "Devices": [],
---
> "Devices": null,
142c142
< "Source": "/mnt/c/temp/postgresql",
---
> "Source": "/c/temp/postgresql",
166,167c166,169
< "Image": "ubuntu",
< "Volumes": null,
---
> "Image": "ubuntu:latest",
> "Volumes": {
> "/db": {}
> },
Steps to Reproduce
mkdir C:\temp
Write the following contents to the c:\temp\docker-compose.yml file docker-compose.yml contents:
version: "3.7"
services:
test1:
image: ubuntu:latest
container_name: ubuntu-test
hostname: ubuntu-test
command: ["ls","-la","/db"]
#command: ["sleep","infinity"]
volumes:
- c:\temp\postgresql:/db:ro
Run the following commands:
mkdir C:\temp\postgresql
echo Hello>C:\temp\postgresql\10-create_users.sh
echo World>C:\temp\postgresql\20-create_dbs.sh
cd C:\temp
docker run -it -v c:\temp\postgresql:/db:ro --name ubuntu-test ubuntu ls -la /db
docker compose run test1
Result
Output from the docker run
total 8
drwxrwxrwx 1 root root 4096 Jun 21 11:07 .
drwxr-xr-x 1 root root 4096 Jun 24 10:56 ..
-rwxrwxrwx 1 root root 520 Jun 21 11:07 10-create_users.sh
-rwxrwxrwx 1 root root 420 Jun 21 11:07 20-create_dbs.sh
Output from the docker compose run
total 8
drwxrwxrwx 1 root root 4096 Jun 21 11:07 .
drwxr-xr-x 1 root root 4096 Jun 24 10:56 ..
Expected Behavior
Both commands should return the same output, and the volumes should be mounted in the exact same way.
Additional Information
I did full cleanup/uninstall of previously used Docker Desktop, Rancher Desktop, WSL and unregistered Debian, Ubuntu, docker-desktop, docker-desktop-data, rancher-desktop, rancher-desktop-data. I removed any profile configurations for docker and rancher desktop. I re-installed WSL, and set version 2 as default. I installed Rancher Desktop with Kubernetes disabled, but enabled it for testing which made no difference, then disabled again. I tried changing the mount point via wsl.conf to / but Rancher is hardcoded to use /mnt, so that didn’t go well.
I now uninstalled Rancher Desktop, removed wsl distros, and re-installed Docker desktop, and it works as expected.
Rancher Desktop Version
1.4.1
Rancher Desktop K8s Version
1.23.6(stable) - not enabled
Which container runtime are you using?
moby (docker cli)
What operating system are you using?
Windows
Operating System / Build Version
Windows 10 Enterprise Version 10.0.19044 Build 19044
What CPU architecture are you using?
x64
Linux only: what package format did you use to install Rancher Desktop?
No response
Windows User Only
Kaspersky Endpoint Security - enabled and disabled but made no difference.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 1
- Comments: 17 (4 by maintainers)
I’m also seeing this - any update?
@jandubois I found what appears to be the issue and explains the difficulties reproducing the original problem. The issue appears related to the
COMPOSE_CONVERT_WINDOWS_PATHSenvironment variable. If the conversion is enabled, compose YAML volumes aren’t mounted correctly; this is true whether the path is an explicit windows path or a relative one like./postgresql. Turning this option off causes the volumes to work, even with explicit windows paths.I’m not sure why this option breaks volumes, nor why windows paths work without it, but I guess I can remove it for now.