Files

12 lines
776 B
Python

import subprocess,json
def run(*a): return subprocess.check_output(a,text=True)
old=json.loads(run('docker','inspect','huobao-model-bridge'))[0]
new=json.loads(run('docker','inspect','huobao-vdn-bridge'))[0]
assert new['State']['Status']=='created', 'only replace the failed, never-started new container'
run('docker','rm','huobao-vdn-bridge')
root='/home/ps/huobao-vdn'
print(run('docker','run','-d','--name','huobao-vdn-bridge','--restart','unless-stopped',
'--network','open-ai-canvas_default','--user','1000:1000','--read-only','--tmpfs','/tmp:rw,noexec,nosuid,size=64m',
'-p','192.168.110.111:18794:8080','-v',root+'/bridge:/bridge:ro','-v',root+'/bridge-state:/state',
'-w','/bridge','--entrypoint','python',old['Image'],*old['Config']['Cmd']).strip()[:12])