DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

Why running a container via docker sdk in python I get different output compared to the actual command line?

I try to interface docker using python:

In a shell session I have run:

 docker run --rm --net host busybox /bin/sh -c "ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p'"

And for a utility script that interfaced docker using python and docker-sdk I run the same command as well:

import docker
client = docker.from_env()
print(client.containers.run('busybox',["/bin/sh","-c","ip

But it seems that I fail to get same output from the one I cat from docker-cli. Can u help me?

Top comments (0)