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
source to share
No one has answered this question yet
Check out similar questions: