operations.docker: add support for custom command#1625
Open
EricDriussi wants to merge 1 commit intopyinfra-dev:3.xfrom
Open
operations.docker: add support for custom command#1625EricDriussi wants to merge 1 commit intopyinfra-dev:3.xfrom
EricDriussi wants to merge 1 commit intopyinfra-dev:3.xfrom
Conversation
Fizzadar
requested changes
Apr 20, 2026
Member
Fizzadar
left a comment
There was a problem hiding this comment.
Hi @EricDriussi sorry for the delay - this looks great, a couple of minor tweaks to the arguments + fix for default / no argument.
| restart_policy: str | None = None | ||
| auto_remove: bool = False | ||
| dns: list[str] = field(default_factory=list) | ||
| command: str = "" |
Member
There was a problem hiding this comment.
Suggested change
| command: str = "" | |
| command: str | None = None |
| args.append("--dns {0}".format(dns)) | ||
|
|
||
| args.append(self.image) | ||
| args.append(self.command) |
Member
There was a problem hiding this comment.
Suggested change
| args.append(self.command) | |
| if self.command: | |
| args.append(self.command) |
| docker.container( | ||
| name="Run a custom command", | ||
| container="alpine", | ||
| command="sh -c 'echo Whatever you want", |
Member
There was a problem hiding this comment.
Suggested change
| command="sh -c 'echo Whatever you want", | |
| command="sh -c "echo Whatever you want", |
| restart_policy: str | None = None, | ||
| auto_remove: bool = False, | ||
| dns: list[str] | None = None, | ||
| command: str = "", |
Member
There was a problem hiding this comment.
None is a nicer default here
Suggested change
| command: str = "", | |
| command: str | None = None, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
3.xat this time)scripts/dev-test.sh)scripts/dev-lint.sh)Hi there! Noticed another thing missing from the docker container operation.
This adds support for custom commands to be run on container start.