Skip to content

fix(up): resolve relative bind mounts from compose file directory - #164

Open
SomSamantray wants to merge 1 commit into
Mcrich23:mainfrom
SomSamantray:fix/relative-volume-paths-compose-directory
Open

SomSamantray wants to merge 1 commit into
Mcrich23:mainfrom
SomSamantray:fix/relative-volume-paths-compose-directory

Conversation

@SomSamantray

@SomSamantray SomSamantray commented Oct 12, 2026 •

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Summary

Running container-compose up -f deploy/docker-compose.yml from the project root resolves a bind mount source like ../data against the process CWD. That points outside project/, so the wrong, often empty directory is mounted. Relative bind-mount sources should resolve from the Compose file directory, as Docker Compose does.

Motivation and Context

build.context and service env_file already resolve relative to the Compose file directory. Bind-mount sources were the exception. Fixes #147.

What changed

Pass the selected Compose file directory to volume resolution so relative bind-mount sources resolve against it. Add static and container-backed regression coverage for ../data:/data with up launched from the project root.

Testing

  • Added static coverage for parent-relative path resolution.
  • Added a container-backed test that checks a healthcheck can read data/marker.txt from the mount.
  • Could not run tests locally because Swift is unavailable in this environment. The Tests workflow is action_required pending maintainer approval; the container-backed regression also requires macOS with Apple Container support.

Code of Conduct

  • I agree to follow this project Code of Conduct

Prepared with OpenAI Codex; this revision by OpenAI Codex CLI with gpt-6-luna.

@Mcrich23

Copy link
Copy Markdown
Owner

Hi! Thanks for the PR. Can please explain what the actual issue you are trying to solve is?

@SomSamantray

Copy link
Copy Markdown
Author

I opened this PR to fix relative bind mounts such as ../data:/data. From the project root, container-compose up -f deploy/docker-compose.yml resolved ../data against the process CWD, pointing outside project/ and mounting the wrong, often empty directory. The expected path is project/deploy/../data → project/data, relative to the Compose file as Docker Compose does (#147).

The existing code already uses the Compose file directory for service env_file (ComposeUp.swift:935) and build.context (ComposeUp.swift:1350); bind mounts were the exception. This PR passes that directory to volume resolution and adds static and container-backed regression coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relative bind-mount volume paths resolve against process CWD instead of compose file directory

2 participants