1 | docker search centos7 | |
2 | docker pull ansible/centos7-ansible | 获取镜像,以此为基础 |
3 | docker run -itd -p 5000:5000 --restart=always --name centos7_tibet ansible/centos7-ansible /bin/bash | //把镜像启动为容器,-i表示让容器的标准输入打开,-t表示分配一个伪终端,-d表示后台启动,要把-i -t -d 放到镜像名字前面 |
4 | docker cp /opt/image_class_install/ centos7_tibet:/opt/ | //把相关安装包copy到相关文件夹下,不支持*的通配符 |
5 | docker exec -it tf_tibet_detect /bin/bash | 进入容器进行交互 |
6 | cd /opt/image_class_install/install/ | |
7 | yum localinstall -y --nogpgcheck libICE-1.0.9-9.el7.x86_64.rpm libSM-1.2.2-2.el7.x86_64.rpm libX11-1.6.7-2.el7.x86_64.rpm libX11-common-1.6.7-2.el7.noarch.rpm libXau-1.0.8-2.1.el7.x86_64.rpm libxcb-1.13-1.el7.x86_64.rpm libXrender-0.9.10-1.el7.x86_64.rpm libXext-1.3.3-3.el7.x86_64.rpm | |
8 | bash Anaconda3-2019.10-Linux-x86_64.sh | |
9 | source ~/.bashrc | 激活python3环境 |
10 | yum-config-manager --add-repo https://download.opensuse.org/repositories/home:/Alexander_Pozdnyakov/CentOS_7/ rpm --import https://build.opensuse.org/projects/home:Alexander_Pozdnyakov/public_key yum update yum install tesseract pip install tesseract pip install pytesseract | |
11 | mv /opt/image_class_install/install/ocr/* /usr/share/tesseract/4/ | 将一些识别字符模块放入 |
12 | tesseract --list-langs //如果显示 如下则为正常 (base) [root@3d1dd0364615 ansible]# tesseract --list-langs List of available languages (9): Tibetan chi_sim chi_sim_best chi_sim_vert chi_tra chi_tra_vert chr eng osd | |
13 | /opt/image_class_install/install/whls | |
14 | python setup_for_cpu.py | 安装识别的python模块 |
15 | 编辑/opt/image_class_install/src/linux_run_server.sh 看里面python运行路径是否正确 nohup /root/anaconda3/bin/python /opt/image_class_install/src/start_server.py > start_server_log.txt & | |
16 | chmod 777 /opt/image_class_install/src/linux_run_server.sh | |
18 | docker commit centos7_tibet tibet_centos7:v1.0 | 将容器存为镜像 |
19 | docker save -o tibet_centos7.tar tibet_centos7:v1.0 | 将镜像存为文件 |
1 | docker load --input tibet_centos7.tar | 导入镜像文件 |
2 | sudo docker run -itd -p 5000:5000 --restart=always --name tibet_detect_1.0 tibet_centos7:v1.0 /bin/bash /opt/image_class_install/src/linux_run_server.sh | 将镜像装入容器 开启5000端口 |
3 | sudo docker exec -it tibet_detect_1.0 /bin/bash | |
4 | docker logs -f tibet_detect_1.0 | 查看日志 |
1.0版本 | 1,获取镜像 sudo wget http://10.10.10.251/E%3A/working/python/YS_Img_Classification/image_class_install/centos_tibet_detection/docker_img/tibet_centos7.tar 2,将本地包导入到镜像中: sudo docker load --input tibet_centos7.tar 3,启动镜像: sudo docker run -itd -p 5000:5000 --restart=always --name tibet_detect_1.0 tibet_centos7:v1.0 /bin/bash /opt/image_class_install/src/linux_run_server.sh | |
停止并删除之前的 | docker stop tibet_detect_1.0 docker rm tibet_detect_1.0 docker rmi tibet_centos7:v1.0 | |
1.1版本 | 1,获取镜像 sudo wget http://10.10.10.251/E%3A/working/python/YS_Img_Classification/image_class_install/linux/centos_tibet_detection/docker_img/tibet_centos7.tar 2,将本地包导入到镜像中: sudo docker load --input tibet_centos7.tar 3,启动镜像: sudo docker run -itd -p 5000:5000 --restart=always --name tibet_detect_1.1 tibet_centos7:v1.1 /bin/bash /opt/image_class_install/src/linux_run_server.sh |
docker常用指令,问题整理
最新推荐文章于 2024-05-21 15:08:04 发布