containers / containers/podman-compose
Volume mounts are wrong under Windows
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
# System
* Windows 10 with WSL2
* Podman setup: `podman-desktop-0.12.0.exe`
* Version: 4.4.1
* podman-compose: installed with `pip3 install podman-compose`
* Version: 1.0.3
# Issue
I can run a postgres database with podman as follows:
```
podman machine ssh mkdir /home/user/postgres
podman run --rm -v /home/user/postgres:/var/lib/postgresql/data -e POSTGRES_PASSWORD=123456 postgres
```
I converted it into a `C:\dev\compose.yml` as follows:
```
version: "3.9"
services:
postgres:
image: postgres
volumes:
- /home/user/postgres:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=123456
```
It is important, that a volume inside WSL2 is used, since a windows mount does not work for postgres. Running `podman-compose up` gives the following output:
```
PS C:\dev> podman-compose up
['podman', '--version', '']
using podman version: 4.4.1
** excluding: set()
['podman', 'network', 'exists', 'dev_default']
podman create --name=dev_postgres_1 --label io.podman.compose.config-hash=123 --label io.podman.compose.project=dev --label io.podman.compose.version=0.0.1 --label com.docker.compose.project=dev --label com.docker.compose.project.working_dir=C:\dev --label com.docker.compose.project.config_files=compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=postgres -e POSTGRES_PASSWORD=123456 -v C:\home\user\postgres:/var/lib/postgresql/data --net dev_default --network-alias postgres postgres
Error: creating container storage: the container name "dev_postgres_1" is already in use by f7b08981712fab6a0595dbf0fde3f7c6ea5245711336ebf5d0c9b25e2f2ddb12. You have to remove that container to be able to reuse that name: that name is already in use
exit code: 125
podman start -a dev_postgres_1
chmod: changing permissions of '/var/lib/postgresql/data': Operation not permitted
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data ... initdb: error: could not change permissions of directory "/var/lib/postgresql/data": Operation not permitted
exit code: 1
```
So, it converts the linux mount `/home/user/postgres` to `C:\home\user\postgres`, which is wrong.
Contributor guide
Assessment
This issue has not been assessed yet.