How to get exec_run exit_code?
See original GitHub issueHi,
I create an ubuntu container and then running exec_run
later. But I can not get the exit_code. exec_run
just return output bytecode. I don’t know whether the executing result is successful or not.
>>> import docker
>>> client = docker.from_env()
>>> container = client.containers.run('ubuntu', command=['/bin/bash'], tty=True, detach=True)
>>> container.exec_run(['not_exist'])
b'rpc error: code = 2 desc = oci runtime error: exec failed: exec: "not_exist": executable file not found in $PATH\r\n'
>>>
I can use APIClient.exec_create(), APIClient.exec_start() and APIClient.exec_inspect()
to achieve the goal. Is there has any high level api to use?
Thanks for your reply.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:7
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Get exit code - Go - Stack Overflow
It's easy to determine if the exit code was 0 or something else. In the first case, cmd.Wait() will return nil (unless there...
Read more >Null exitCode ispecting a running exec · Issue #748 ... - GitHub
Im getting a JsonMappingException : Instantiation of [simple type, class com.spotify.docker.client.messages.ExecState] value failed: Null ...
Read more >Ubuntu Manpage: docker-container-exec - Run a command in ...
docker-container-exec - Run a command in a running container ... The exit code from docker exec gives information about why the container failed...
Read more >Get exit code from command "exec" - Unix Stack Exchange
If you want your shell to interpret the exit code of a program, you cannot use exec to do it. Just run the...
Read more >Resource Type: exec - Puppet
This exec would only run if every command in the array has an exit code of 0 (success). (↑ Back to exec attributes)....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
imo, with the next breaking release
Container.exec_run
should return two values in that order: the exit code and the tty output, ifstream
isFalse
.Hope this helps: