see
https://www.cnpython.com/qa/221588
key point:
run(‘docker ps -a | grep {} | awk "{print $1}"‘.format(container_name)) KeyError: ‘print $1‘
solution: 通过用{}包围来转义{}
so it should be:
run(‘docker ps -a | grep {} | awk "{{print $1}}"‘.format(container_name))
原文:https://www.cnblogs.com/LeoGIS/p/14421194.html