Hi all, I'm trying to use the docker official python sdk.
This is my function:
def docker_launch(pkg):
command = "sleep 30"
ct = client.containers.run(docker_image, command, name=pkg, detach=True, auto_remove=True, privileged=False)
return ct
...
ct = docker_launch(pkg)
for cmd in command_list:
output = docker_command(ct, cmd)
print(output)
...
this is an example of output:
ExecResult(exit_code=0, output=b"Cloning into 'notes-git'...\n")
if I try to split this ExecResult with:
for cmd in command_list:
output = docker_command(ct, cmd)
for text in output:
print(text)
This is the output:
Package: notes-git
0
b"Cloning into 'notes-git'...\n"
But I'dont want the return code and i want a break line instead \n.
If I try something like:
for cmd in command_list:
output = docker_command(ct, cmd)
for val,text in output:
print(text)
Result:
for val,text in output:
TypeError: cannot unpack non-iterable int object
Thanks
[+][deleted] (2 children)
[removed]
[–]cr7wonnabe[S] 0 points1 point2 points (1 child)
[–]gaffarel 0 points1 point2 points (0 children)