feat: add `--remove-orphans` flag to `compose down`
test-integration-docker-compatibility seems failing
=== RUN TestComposeDownRemoveOrphans
compose_down_linux_test.go:54: projectName="nerdctl-compose-test-1662693203"
compose_down_linux_test.go:61: assertion failed: res.ExitCode is not exitCode: Stopping nerdctl-compose-test-1662693203_test_1 ...
Stopping nerdctl-compose-test-1662693203_test_1 ... done
Found orphan containers (nerdctl-compose-test-1662693203_orphan_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Removing nerdctl-compose-test-1662693203_test_1 ...
Removing nerdctl-compose-test-1662693203_test_1 ... done
Removing network nerdctl-compose-test-1662693203_default
error while removing network: network nerdctl-compose-test-1662693203_default id b2cad4ddcb3f07d66fe38fab5a38577b69c241cd90f41153e24be5c7097ab71c has active endpoints
--- FAIL: TestComposeDownRemoveOrphans (23.30s)
test-integration-docker-compatibilityseems failing=== RUN TestComposeDownRemoveOrphans compose_down_linux_test.go:54: projectName="nerdctl-compose-test-1662693203" compose_down_linux_test.go:61: assertion failed: res.ExitCode is not exitCode: Stopping nerdctl-compose-test-1662693203_test_1 ... Stopping nerdctl-compose-test-1662693203_test_1 ... done Found orphan containers (nerdctl-compose-test-1662693203_orphan_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. Removing nerdctl-compose-test-1662693203_test_1 ... Removing nerdctl-compose-test-1662693203_test_1 ... done Removing network nerdctl-compose-test-1662693203_default error while removing network: network nerdctl-compose-test-1662693203_default id b2cad4ddcb3f07d66fe38fab5a38577b69c241cd90f41153e24be5c7097ab71c has active endpoints --- FAIL: TestComposeDownRemoveOrphans (23.30s)
@AkihiroSuda Thanks for your help. I think the main reason is the different behavior of docker and nerdctl. Could your please take a look at this scenario?
Is this still draft?
Looks good but needs squashing commits
maybe also rebase to get the fix for flaky tests
@AkihiroSuda @djdongjin Hi, sorry for the delay. PTAL.
Please squash commits
@AkihiroSuda I used git rebase -i to squash into one commit, but didn't expect to get this result. What should I do now? Execute git rest by reflog to reverse?
@stillfox-lee can you try this and see if it works?
First update your local main branch (git checkout main; git pull upstream main)
Then rebase this branch and resolve conflict (git checkout compose/down-remove-orphans; git rebase main)
Otherwise, maybe you can also try create a new local branch and cherrypick your own commit to the new branch and force push from the new local branch to the old remote branch.
Otherwise, maybe you can also try create a new local branch and cherrypick your own commit to the new branch and force push from the new local branch to the old remote branch.
@djdongjin It works! Thanks a lot.
By the way, how should I squash commits in this case (merged main branch already)?
By the way, how should I squash commits in this case (merged main branch already)?
Personally I don't use merge much and use more rebase, so in my case (assume I create 5 commits):
# update local main
git checkout main
git pull upstream main
# rebase dev branch, so my 5 commits are on the top
git checkout dev
git rebase main
# squash / interactively rebase the latest 5 commits
git rebase -i HEAD~5
By the way, how should I squash commits in this case (merged main branch already)?
Personally I don't use
mergemuch and use morerebase, so in my case (assume I create 5 commits):# update local main git checkout main git pull upstream main # rebase dev branch, so my 5 commits are on the top git checkout dev git rebase main # squash / interactively rebase the latest 5 commits git rebase -i HEAD~5
Got it. Thanks.