Error: docker: invalid reference format.
HOST: Windows 10
Scripting language: Python
docker command used:
runc_vvc_docker_container = ‘docker run -d --name ’ + container_name + ’ --rm -v ’ + mount_dir + ‘:/shared/vvc’ + ’ --privileged -p 2210:2210 -p 8010:8010 ’ + image_to_run + ’ tail -f /dev/null’
print(runc_vvc_docker_container)
output = os.system(runc_vvc_docker_container)
print(output)
Backgroud:
I want to run the container in back-end, and run vvc custom configurations in later stage.(i.e vvc -u -c “custom_config.cfg”)
Strange behavior:
print(runc_vvc_docker_container) results in → docker run -d --name SWQT --rm -v D:/Work/Blackhole/Azure_Reference_Repo/VRTE_FCs/str-psx-emmc-utils/_qt_project:/shared/vvc --privileged -p 2210:2210 -p 8010:8010 xyz.com/ela7si/vvc:imagename tail -f /dev/null
- Above command when run on the windows command prompt manually - it runs with no error.
- But when run through python script, results in docker: invalid reference format.
# Working -
subprocess.call('docker run -it --name ’ + container_name + ’ --rm -v ’ + mount_dir + ':/shared/vvc ’ + '–privileged -p 2210:2210 -p 8010:8010 ’ + image_to_run, shell=True)
# Not Working - and also throws Error : docker: invalid reference format.
subprocess.call('docker run -it --name ’ + container_name + ’ --rm -v ’ + mount_dir + ':/shared/vvc ’ + ‘–privileged -p 2210:2210 -p 8010:8010 ’ + image_to_run + ’ tail -f /dev/null’, shell=True)
# Working - runc_vvc_docker_container = 'docker run -d --name ’ + container_name + ’ --rm -v ’ + mount_dir + ‘:/shared/vvc’ + ’ --privileged -p 2210:2210 -p 8010:8010 ’ + image_to_run
os.system(runc_vvc_docker_container)
# Not Working - runc_vvc_docker_container = 'docker run -d --name ’ + container_name + ’ --rm -v ’ + mount_dir + ‘:/shared/vvc’ + ’ --privileged -p 2210:2210 -p 8010:8010 ’ + image_to_run + ’ tail -f /dev/null’
os.system(runc_vvc_docker_container)
Options tried:
- shared directory in all small letters
- both windows and linux path separator(‘/’ and ‘') and also with double slahses (’//')
- ried with and without interactive (-it) mode
output = os.system(runc_vvc_docker_container)
print(output) → results in 125 error code.