I have a python script to start some containers, wait for them to finish execution and then start a few others. I wanted to get the container logs and this bash command worked for me:
docker logs -f container-name &> tmp.log &
However when I try to add it to my python script using `subprocess.run like below, it doesn't create a new file.
subprocess.run(
[
"docker",
"logs",
"-f",
"container-name",
"&>",
"tmp.log",
"&"
],
cwd=os.getcwd(),
shell=False,
stdout=subprocess.DEVNULL,
)