Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add force-recreate and no-recreate for compose up command #3687

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

pendo324
Copy link
Contributor

Enable two missing docker compose up options: --force-recreate and --no-recreate

Also made it so that only logs from the latest run are displayed in the user's terminal (otherwise, all logs will be displayed, which could be confusing to users). This is the same behavior as the docker CLI today.

One issue which I noticed is that my testing container would keep getting a new IP address in its IPAM bridge network. I think as of #2839, the iptables rules should be cleaned up when a container is stopped, but its not happening for me for some reason.

cmd/nerdctl/compose/compose_up.go Outdated Show resolved Hide resolved
cmd/nerdctl/compose/compose_up.go Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

I think an integration test might be good to add. It will be a little effort but if you can have a test that does compose up on a container that creates a sentinel file on a volume mount and dies if the sentinel was not found. For --force-recreate the container should comeback and for --no-recreate the container should stay stopped.

}
}
// container doesn't exist
return "", nil
Copy link
Member

Choose a reason for hiding this comment

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

Should container not exist be an error condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think empty string + nil error is a good enough indication of a non-existent container and setting err should be saved for anything unexpected. WDTY?

Copy link
Member

Choose a reason for hiding this comment

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

Yep sounds good. Thanks for taking another look.

@pendo324 pendo324 force-pushed the add-no-recreate-to-up branch from f2447f1 to 090aa99 Compare November 21, 2024 23:47
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Could you update docs/command-reference.md too?

@AkihiroSuda
Copy link
Member

ping @pendo324

@AkihiroSuda AkihiroSuda added this to the v2.0.2 (tentative) milestone Dec 2, 2024
@pendo324
Copy link
Contributor Author

pendo324 commented Dec 2, 2024

Could you update docs/command-reference.md too?

Will have a new revision out shortly. Sorry for the delay

@pendo324 pendo324 force-pushed the add-no-recreate-to-up branch from 090aa99 to 69de5dd Compare December 2, 2024 21:40
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

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 eed4480 into containerd:main Dec 3, 2024
30 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.

3 participants