Unwanted exception when a container exits with non-zero status
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
Hi dudes,
Thank you for this library, it's simply awesome.
I want to ask you a question cause I'm having troubles when trying to get the output from a docker container which, in my use-case, will always return a non-zero status after finishing its execution.
My last try is:
container = clientDocker.containers.run('zricethezav/gitleaks',
'-v --pretty -r https://github.com/Pitenager/P4-PabloRuiz_MiguelMayoral > scan.txt',
auto_remove=True,
)
But it drops the following exception:
Exception has occurred: ContainerError
Command '-v -r https://github.com/Pitenager/P4-PabloRuiz_MiguelMayoral --pretty > scan.txt' in image 'zricethezav/gitleaks' returned non-zero exit status 1
The image i'm trying to run (zricethezav/gitleaks) will always return a non-zero status in my case cause it's the expected case, so how can I manage it?
Also, if there is a better option to save the output of the tool better than > scan.txt I would appreciate your ideas.
Thank you all !
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the clientDocker.containers.run call with the zricethezav/gitleaks image and read how ContainerError handles non-zero exit statuses. Determine whether the library should expose the output without raising or whether the expected behavior needs documentation; done means the non-zero result and output-handling path are clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100