openvino docker 环境搭建

更换apt源

sudo su
cp /etc/apt/sources.list /etc/apt/sources.list.bak

echo "deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
" > /etc/apt/sources.list

安装宿主机基础开发环境

echo "================================================================================================================"
echo "apt update & upgrade"
apt-get update
apt-get upgrade

echo "================================================================================================================"
echo "apt install net-tools openssh-server htop intel-gpu-tools"

apt-get install net-tools -y
apt-get install openssh-server -y
apt-get install htop -y
apt-get install curl -y
# sudo apt-get install intel-gpu-tools -y
# sudo apt-get install redis-server

宿主机安装 Docker

# 安装
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
# 启动
sudo systemctl start docker
# 开机启动脚本位置
vi /etc/rc.local 

OpenVINO Model Server Docker

2021.1, latest - support for CPU, NCS and HDDL accelerators
2021.1-gpu, latest-gpu - support for CPU, NCS, HDDL and iGPU acceleration
2020.4
2020.3

# 参考
docker pull openvino/model_server:latest
docker pull openvino/model_server:latest-gpu

Openvino 2021.1 Docker

参考 Openvino release notes:https://software.intel.com/content/www/us/en/develop/articles/openvino-relnotes.html
Openvino 某些推断环境,要求 Linux Kernel 5.3 以上。
我们采用:Ubuntu 20.04 with Linux kernel 5.4
宿主机,桌面版ubuntu,选择操作系统升级后,可以升到 kernel 5.4

docker pull ubuntu:20.04
# 查看kernel版本
cat /proc/version
# 查看ubuntu版本
cat /etc/issue
# 下载 官方 docker
docker pull openvino/ubuntu18_runtime:2021.1
docker pull openvino/ubuntu18_dev:2021.1
# 把下载下来的镜像,放到自己的镜像仓库
docker login ...(略)
sudo docker tag [imageID] cue-aurora.tencentcloudcr.com/opvn/ubuntu18_runtime:2021.1
sudo docker push cue-aurora.tencentcloudcr.com/opvn/ubuntu18_runtime:2021.1
sudo docker tag [imageID] cue-aurora.tencentcloudcr.com/opvn/ubuntu18_dev:2021.1
sudo docker push cue-aurora.tencentcloudcr.com/opvn/ubuntu18_dev:2021.1
# run docker ssh 端口映射启动
docker run -itd --name opvn2021.1_dev -p 12021:22 cue-aurora.tencentcloudcr.com/opvn/ubuntu18_dev:2021.1 /bin/bash
docker run -itd --name opvn2021.1_runtime -p 12022:22 cue-aurora.tencentcloudcr.com/opvn/ubuntu18_runtime:2021.1 /bin/bash
# docker exec --user root 进入container
docker exec -it --user root opvn2021.1_dev /bin/bash
docker exec -it --user root opvn2021.1_runtime /bin/bash
# 安装openssh-server
su root
apt update
# 安装配置 ssh server
apt install openssh-server
vi /etc/ssh/sshd_config  
`````PermitRootLogin yes`````
service ssh restart
# 修改密码
passwd root
passwd openvino
# 自动初始化 openvino 环境
vi ~/.bashrc
`````source /opt/intel/openvino_2021.1.110/bin/setupvars.sh`````
# run docker ssh 端口映射启动
docker run -itd --name opvn2021.1_dev -p 12021:22 cue-aurora.tencentcloudcr.com/opvn/ubuntu18_dev:2021.1 /bin/bash
docker run -itd --name opvn2021.1_runtime -p 12022:22 cue-aurora.tencentcloudcr.com/opvn/ubuntu18_runtime:2021.1 /bin/bash
# 远程登陆
2021.2 dev
ssh -p 12021 root@81.70.76.135
2021.1 runtime
ssh -p 12022 root@81.70.76.135

推荐阅读更多精彩内容