Docker exec command with Popen in Python

I am developing an application in which I interact with docker containers.

I want to execute this command in the docker exec name_of_container command : command= "/usr/bin/balance -b "+ ip_address + " 5001 " + servers_list

The idea is to make the echo command β†’ / etc / supervisor / conf.d / supervisord.conf`

I tried the following:

p=subprocess.Popen(['docker','exec','supervisor','echo','command'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)

but that won't work.

This is the error code:

exec: "'/usr/bin/balance -b 195.154.12.1 5001 192.186.13.1' >> /etc/supervisor/conf.d/supervisord.conf": stat '/usr/bin/balance -b 195.154.12.1 5001 192.186.13.1' >> /etc/supervisor/conf.d/supervisord.conf: no such file or directory

      

+3
python docker


source to share


No one has answered this question yet

Check out similar questions:

5504
Does Python have a ternary conditional operator?
5231
What are metaclasses in Python?
5116
How can I check if a file exists without exceptions?
4473
Calling an external command in Python
3790
How can I safely create a subdirectory?
3602
Does Python have a substring method "contains"?
3382
How is Docker different from a virtual machine?
1930
What is the difference between the "COPY" and "ADD" commands in the Dockerfile?
1727
Should I use Vagrant or Docker to create an isolated environment?
1148
How to remove old Docker containers



All Articles
Loading...
X
Show
Funny
Dev
Pics