1 运行容器里的程序 ,共享主机,内存,执行多条sh命令
docker run -it --net=host --ipc=host safetyhatv0 sh -c "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/MPM/safetyHat/project/shareLib && cd /MPM/safetyHat/project/ZhuZhiYun_SafetyHat_V0/build && ./ZhuZhiYun_SafetyHat_V0 9090"
2 docker直接后台运行宿主机里面的程序,注意宿主机中的程序的编译环境和链接库与容器的环境一致,也就是宿主机中的程序和链接库是经过容器里的环境编译后再存储在宿主机里的
docker run -d --ipc=host --net=host -v /MPM/safetyHat/project:/MPM/safetyHat/project safetyhatv0 sh -c "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/MPM/safetyHat/project/shareLib && cd /MPM/safetyHat/project/ZhuZhiYun_SafetyHat_V0/build && ./ZhuZhiYun_SafetyHat_V0 8090"
3 遇到 unable to xxxx daemon unix.socket xxx的错误可以尝试
systemctl stop firewalld.service
setenforce 0
开启服务,并设为开机自启
systemctl start docker.service
systemctl enable docker.service
在线调试
docker run -it --net=host -v /usr_data/cason/tmp/depressive:/depressive detpressive:v2_pure sh -c "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/depressive/inference_v1/shareLib && cd /depressive/inference_v1 && python3 detServer_v2.py"
后台运行
docker run -d --ipc=host --net=host -v /usr_data/cason/tmp/depressive:/depressive detpressive:v2_pure sh -c "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/depressive/inference_v1/shareLib && cd /depressive/inference_v1 && python3 detServer_v2.py"