I am very new to docker so I am highly confused.
a= 'o1 & o2 | -o3'
p=subprocess.Popen("docker run -ti ajaveeda/satisker:first /data/satisolve '{} ".format(a + " ' "),shell=True, stdout=subprocess.PIPE, stderr=sys.stderr)
output, err = p.communicate()
output = output.decode('utf-8')
print(output)
I installed a docker toolbox to my Windows 10 computer. When I type "docker run -ti ajaveeda/satisker:first /data/satisolve "o1 & o2 | -o3" "
, docker gives me
"SATISFIABLE
Solution:
o1 = True,
o2 = False,
o3 = False" as an output. By using a code piece given above, I want to invoke docker from a python code and print out the output. However, when I use the code piece, I get
io.UnsupportedOperation: fileno
error. How can I fix this problem?
When you run subprocess using python it creates a child process and delivers the command to it. So, when you run docker run command it creates an conatiner instance and lets you run a command inside the container.
When you run docker run, it creates a conatiner and remains inside the conatiner.
docker run --rm inside your python code
This will exit from the conatiner once the command is executed. Please check the quotes formatting once subprocess.Popen()