Skip to content

Unable to mount paths inside WSL podman machine when running on Windows #1352

@mszmida

Description

@mszmida

Describe the bug
The podman-compose is unable to mount paths correctly inside the WSL podman machine when running on a Windows OS. In my scenario, I need to mount MariaDB Unix socket from a mariadb container on a WSL podman machine so that I can share Unix socket with the php container. As we know Unix sockets are not supported by Windows, so mounting them on Windows file system does not make sense.

Podman machine works in rootless mode.

Please make sure it's not a bug in podman (in that case report it to podman)
or your understanding of docker-compose or how rootless containers work (for example, it's normal for rootless container not to be able to listen for port less than 1024 like 80)

I am sure this is podman-compose bug, because podman mounts paths correctly. When we create the mysqld directory in the WSL podman machine and run:

podman run --name mariadb-test -v /home/user/mysqld:/var/run/mysqld --env MARIADB_USER=user --env MARIADB_PASSWORD=pass --env MARIADB_ROOT_PASSWORD=root_pass --env MARIADB_DATABASE=db mariadb:latest

After ssh into WSL podman machine we can see:

podman machine ssh
Connecting to vm podman-machine-default. To close connection, use `~.` or `exit`
Last login: Sat Dec 13 19:10:09 2025 from ::1
[user@DESKTOP-USIP4GD ~]$ ls -la mysqld/
total 12
drwxr-xr-x 2 525286 525286 4096 Dec 15 12:24 .
drwx------ 7 user   user   4096 Dec 15 12:24 ..
-rw-rw---- 1 525286 525286    2 Dec 15 12:24 mysqld.pid
srwxrwxrwx 1 525286 525286    0 Dec 15 12:24 mysqld.sock

To Reproduce
Steps to reproduce the behavior:

  1. Lat's analyze the following docker-compose.yml file:
version: '3.8'
services:
    nginx:
        image: nginx:latest
        container_name: nginx
        ports:
            - "8080:80"
        networks:
            - internal
        restart: unless-stopped
    php:
        image: php:8.5-fpm
        container_name: php
        networks:
            - internal
        restart: unless-stopped
    mariadb:
        image: mariadb:latest
        container_name: mariadb
        environment:
            MARIADB_USER: 'user'
            MARIADB_PASSWORD: 'pass'
            MARIADB_ROOT_PASSWORD: 'root_pass'
            MARIADB_DATABASE: 'db'
        ports:
            - 3306:3306
        networks:
            - internal
        volumes:
            - type: bind
              source: /home/user/mysqld
              target: /var/run/mysqld
        restart: unless-stopped

networks:
    internal:
        driver: bridge
  1. Let's take a look at the definition of bind mount:
    volumes:
        - type: bind
          # This path should be mounted inside the WSL podman machine, which is the Fedora distribution.
          source: /home/user/mysqld
          # This is the path to the directory where the mariadb container stores its unix socket.
          target: /var/run/mysqld
  1. Inside directory with docker-compose.yml file run:
podman compose --verbose --dry-run up mariadb
  1. We should see the following output:
>>>> Executing external compose provider "C:\\Users\\mck\\AppData\\Local\\Programs\\Python\\Python314\\Scripts\\podman-compose.exe". Please see podman-compose(1) for how to disable this message. <<<<

DEBUG:podman_compose:** excluding: {'php', 'nginx'}
INFO:podman_compose:building images: ...
INFO:podman_compose:['podman', 'ps', '--filter', 'label=io.podman.compose.project=podman-compose-test', '-a', '--format', 'json']
INFO:podman_compose:podman pod exists pod_podman-compose-test
INFO:podman_compose:podman pod create --name=pod_podman-compose-test --infra=false --share=
INFO:podman_compose:creating missing containers: ...
DEBUG:podman_compose:** skipping create: nginx
DEBUG:podman_compose:** skipping create: php
INFO:podman_compose:['podman', 'network', 'exists', 'podman-compose-test_internal']
INFO:podman_compose:podman create --name=mariadb --pod=pod_podman-compose-test --label io.podman.compose.config-hash=53998c54803774e43b5d17b3a93a3cb81575d9f206752276658e44ddb8f6c8c5 --label io.podman.compose.project=podman-compose-test --label io.podman.compose.version=1.5.0 --label PODMAN_SYSTEMD_UNIT=podman-compose@podman-compose-test.service --label com.docker.compose.project=podman-compose-test --label com.docker.compose.project.working_dir=D:\Web\podman-compose-test --label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 --label io.podman.compose.service=mariadb --label com.docker.compose.service=mariadb -e MARIADB_USER=user -e MARIADB_PASSWORD=user_pass -e MARIADB_ROOT_PASSWORD=root_pass -e MARIADB_DATABASE=db -v D:\home\user\mysqld:/var/run/mysqld --network=podman-compose-test_internal:alias=mariadb -p 3306:3306 --restart unless-stopped mariadb:latest

In the output above there is a snippet showing the processed mount path:

... -e MARIADB_DATABASE=db -v D:\home\user\mysqld:/var/run/mysqld --network=podman-compose-test_internal:alias=mariadb ...

As we can see the mount path is created inside the Windows filesystem in the path:

D:\home\user\mysqld

Expected behavior
The volume should be mounted inside the WSL podman machine in the path:

/home/user/mysqld

Actual behavior
The volume is mounted inside the Windows filesystem in the path:

D:\home\user\mysqld

Output

podman compose --version
>>>> Executing external compose provider "C:\\Users\\mck\\AppData\\Local\\Programs\\Python\\Python314\\Scripts\\podman-compose.exe". Please see podman-compose(1) for how to disable this message. <<<<

podman-compose version 1.5.0
podman version 5.7.1

Environment:

  • OS: Windows 11 / WSL
  • podman version: 5.7.1
  • podman compose version: 1.5.0

Additional context
The podman was installed directly on Windows 11 using the standard installer. The podman-compose was installed as follows:

pip3 install podman-compose

I managed to find a workaround for this problem by defining the volume source path using the Windows npipe syntax as follows:

    volumes:
        - type: bind
          # This Windows npipe is mounted inside the WSL podman machine in the path /mnt/wsl/pipe/mysqld (need to exist)
          source: \\.\pipe\mysqld
          target: /var/run/mysqld

To me this only seems like a temporary solution. This is not documented anywhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions