Skip to content

fix: honor --workdir in compose run - #4986

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
immanuwell:fix-compose-run-workdir
Jun 19, 2026
Merged

fix: honor --workdir in compose run#4986
AkihiroSuda merged 1 commit into
containerd:mainfrom
immanuwell:fix-compose-run-workdir

Conversation

@immanuwell

Copy link
Copy Markdown
Contributor

Fix nerdctl compose run --workdir so it actually sets the container cwd.

Right now compose run --workdir /tmp writes /tmp into the project working dir, not the service working dir. So pwd still does not run from /tmp, and relative host paths can get a bit weird too.

Repro

  1. Create a compose file with:
services:
  app:
    image: alpine
    entrypoint:
      - pwd
  1. Run nerdctl compose run --workdir /tmp app
  2. Before this patch, it does not print /tmp

This patch writes ro.WorkDir to targetSvc.WorkingDir, which is what serviceparser turns into -w=.... Added a regression test too, pretty small and to the point.

Signed-off-by: Immanuel Tikhonov <pchpr.00@list.ru>
@AkihiroSuda AkihiroSuda added this to the v2.3.3 milestone Jun 19, 2026

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda
AkihiroSuda merged commit 7782b30 into containerd:main Jun 19, 2026
48 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants