containers / containers/podman-compose
podman-compose config should expand relative path
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
vscode devcontainer build failed when using `podman-compose` instead of `docker-compose`
**Debug**
- `docker-compose` expand relative path './xxx' '../xxx' to abosolute path, while `podman-compose` doesn't. And vscode devcontainer builder cwd is not parent dir of compose file. So, BOOM!
- Above inffect `.services.XXX.build.context`, `.services.XXX.volumes[XXX]`
**To Reproduce**
Steps to reproduce the behavior:
vscode settings
~/.config/Code/User/settings.json
```
"dev.containers.dockerPath": "/tmp/podman-devcontainer-wrapper",
"dev.containers.dockerComposePath": "/tmp/podman-compose-devcontainer-wrapper"
```
```
$ cat /tmp/podman-devcontainer-wrapper
#!/bin/bash
BUILDAH_FORMAT=docker \
PODMAN_USERNS=keep-id \
podman "$@"
$ cat /tmp/podman-compose-devcontainer-wrapper
#!/bin/bash
BUILDAH_FORMAT=docker \
PODMAN_USERNS=keep-id \
~/.local/bin/podman-compose "$@"
```
---
reproduce
```
$ pip3 install https://github.com/containers/podman-compose/archive/devel.tar.gz
$ cd /tmp/reproduce
$ cat .devcontainer/docker-compose.yml
version: '3'
services:
devcontainer:
build:
context: .
dockerfile: Dockerfile
volumes:
- ..:/repo:cached
- ../../dotfiles:/dotfiles:cached
command: sleep infinity
```
**Expected behavior**
```
$ docker-compose -f ./.devcontainer/docker-compose.yml config
name: devcontainer
services:
devcontainer:
build:
context: /tmp/reproduce/.devcontainer
dockerfile: Dockerfile
command:
- sleep
- infinity
networks:
default: null
volumes:
- type: bind
source: /tmp/reproduce
target: /repo
bind:
create_host_path: true
- type: bind
source: /tmp/dotfiles
target: /dotfiles
bind:
create_host_path: true
networks:
default:
name: devcontainer_default
```
**Actual behavior**
```
$ BUILDAH_FORMAT=docker PODMAN_USERNS=keep-id ~/.local/bin/podman-compose -f ./.devcontainer/docker-compose.yml config
podman-compose version: 1.0.4
['podman', '--version', '']
using podman version: 4.3.1
services:
devcontainer:
build:
context: .
dockerfile: Dockerfile
command: sleep infinity
volumes:
- ..:/repo:cached
- ../../dotfiles:/dotfiles:cached
version: '3'
```
**Output**
Grab from real world case error output
```
[2257 ms] Start: Run: /tmp/podman-compose-devcontainer-wrapper -f /path/to/.devcontainer/docker-compose.yml config
...
[2337 ms] Error: ENOENT: no such file or directory, open '/home/xxx/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/Dockerfile'
...
```
**Environment:**
- OS: Linux / WSL / Mac
- podman version:
- podman compose version: (git hex)
**Additional context**
Rewrite podman-compose in golang
https://github.com/containers/podman-compose/issues/621
Contributor guide
Research direction
Reproduce the behavior with .devcontainer/docker-compose.yml and the podman-compose config command shown in the issue, comparing its output with docker-compose config. Trace the config handling that produces build.context and volume paths; done means relative paths are expanded to absolute paths based on the compose file location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100