containers / containers/podman-compose
Running `podman-compose` on Windows with WSL-`volumes` defined results in folders being created under `C:\`
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When I run `podman-compose up` from Windows PowerShell with a `compose.yaml` that has `volumes` defined referring to WSL filepaths (i.e. with just a leading `/`, with Windows paths referred to with `/mnt/c/`), then these are somehow being treated as relative to `C:/` and resulting in directories being created in Windows (i.e. resulting in `C:/mnt/c/...` to be created).
Example `compose.yaml`:
```
name: myservice
services:
myservice:
image: quay.io/podman/hello
container_name: myservice
volumes:
- type: bind
source: /home/user/dev/sites/myservice
target: /var/www/html
read_only: true
- type: bind
source: /mnt/c/FakeUsersDir/Me/dev/logs/myservice.log
target: /var/log/php-fpm/www-error.log
```
**To Reproduce**
Steps to reproduce the behavior:
1. Create a `compose.yaml` with the above contents somewhere.
2. Create an empty file at `C:\FakeUsersDir\Me\dev\logs\myservice.log` from within Windows.
3. Create an empty directory at `/home/user/dev/sites/myservice` from within the `podman-machine-default` WSL instance.
4. Run `podman-compose up` from within the same directory as `compose.yaml`.
**Expected behavior**
The following directories are **not** created on the Windows side:
- `C:\home\user\dev\sites\myservice`
- `C:\mnt\c\FakeUsersDir\Me\dev\logs\myservice.log`
**Actual behavior**
The aforementioned directories are created...
**Output**
Version and command output
```log
PS C:\Users\$USER\dev\docker\myservice> podman version
Client: Podman Engine
Version: 4.3.1
API Version: 4.3.1
Go Version: go1.18.5
Git Commit: 814b7b003cc630bf6ab188274706c383f9fb9915
Built: Fri Nov 11 00:18:45 2022
OS/Arch: windows/amd64
Server: Podman Engine
Version: 4.3.1
API Version: 4.3.1
Go Version: go1.18.7
Built: Sat Nov 12 01:24:13 2022
OS/Arch: linux/amd64
PS C:\Users\$USER\dev\docker\myservice> podman-compose version
['podman', '--version', '']
using podman version: 4.3.1
podman-composer version 1.0.3
podman --version
podman version 4.3.1
exit code: 0
PS C:\Users\$USER\dev\docker\myservice> podman-compose up
['podman', '--version', '']
using podman version: 4.3.1
** excluding: set()
['podman', 'network', 'exists', 'myservice_default']
podman create --name=myservice --label io.podman.compose.config-hash=123 --label io.podman.compose.project=myservice --label io.podman.compose.version=0.0.1 --label com.docker.compose.project=myservice --label com.docker.compose.project.working_dir=C:\Users\$USER\dev\docker\myservice --label com.docker.compose.project.config_files=compose.yaml --label com.docker.compose.container-number=1 --label com.docker.compose.service=myservice -v /home/user/dev/sites/myservice:/var/www/html:ro -v /mnt/c/FakeUsersDir/Me/dev/logs/myservice.log:/var/log/php-fpm/www-error.log --net myservice_default --network-alias myservice quay.io/podman/hello
Trying to pull quay.io/podman/hello:latest...
Getting image source signatures
Copying blob sha256:e46e57ecb4be23b9e8517f272c629b5b289281997a30b177ba4d89d3dacd0c69
Copying config sha256:edd8c597f15575e76ca07624bae7db5bdd1ed06ac41bffde247b16eb91a14a96
Writing manifest to image destination
Storing signatures
350c1c0820490f03c26b2ce56a2462832f95300e5530b50de41b030bb4d2d2f8
exit code: 0
podman start -a myservice
!... Hello Podman World ...!
.--"--.
/ - - \
/ (O) (O) \
~~~| -=(,Y,)=- |
.---. /` \ |~~
~/ o o \~~~~.----. ~~
| =(X)= |~ / (O (O) \
~~~~~~~ ~| =(Y_)=- |
~~~~ ~~~| U |~~
Project: https://github.com/containers/podman
Website: https://podman.io
Documents: https://docs.podman.io
Twitter: @Podman_io
exit code: 0
```
**Environment:**
- OS: WSL
- podman version: 4.3.1
- podman compose version: 1.0.3
**Additional context**
`podman` is installed on Windows/WSL using Podman Desktop, with `podman-compose` installed using `pip3 install podman-compose`
Contributor guide
Assessment
This issue has not been assessed yet.