1 Star 0 Fork 10

QMGPS/dev-env-ubuntu

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
run-container-ubuntu-dev.sh 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
kang 提交于 2021-10-29 20:31 . support 16.04&18.04
#!/bin/bash
set -e
# -------------------------------------------------------------------------------
# Filename: run-container-ubuntu-dev.sh
# UpdateDate: 2021/09/27
# Description: Run docker image for IDE.
# Example:
# ./run-container-ubuntu-dev.sh
# ./run-container-ubuntu-dev.sh 16.04
# ./run-container-ubuntu-dev.sh 18.04
# Depends: container-$OS-$PATH_WORK-$VERSION
# Notes:
# -------------------------------------------------------------------------------
#Dockerfile(16.04/18.04/CentOS)
OSVer="16.04"
if [[ $# -ne 0 ]];then OSVer="${1}";fi
# Source env
source ./env.sh $OSVer
######Modify according to your development environment#####
#Share path on the host
PATH_SHARE_HOST="$PWD"
#Share path on the docker container
PATH_SHARE_DOCKER="/home/share"
#SDK path on the host
PATH_FTP_HOST="/data/ftp"
#Work path on the docker container
PATH_FTP_DOCKER="/home/ftp"
#Datasets path on the host
PATH_DATASETS_HOST="/data/datasets"
#Datasets path on the docker container
PATH_DATASETS_DOCKER="/data/datasets"
#Models path on the host
PATH_MODELS_HOST="/data/models"
#Models path on the docker container
PATH_MODELS_DOCKER="/data/models"
##########################################################
#Check docker images
[ ! -z $(sudo docker images -q $NAME_IMAGE) ] || (echo -e "${red}ERROR: Images(${NAME_IMAGE}) does not exist! ${none}" && exit -1)
#Check docker container
num=`sudo docker ps -a|grep -w "$MY_CONTAINER$"|wc -l`
echo $num
echo $MY_CONTAINER
#Run docker
if [ 0 -eq $num ];then
#sudo xhost +
sudo docker run -e DISPLAY=unix$DISPLAY --privileged=true \
--device /dev/cambricon_dev0 \
--net=host --ipc=host --pid=host \
-v /sys/kernel/debug:/sys/kernel/debug \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-it -v $PATH_SHARE_HOST:$PATH_SHARE_DOCKER \
-it -v $PATH_FTP_HOST:$PATH_FTP_DOCKER \
-it -v $PATH_DATASETS_HOST:$PATH_DATASETS_DOCKER \
-it -v $PATH_MODELS_HOST:$PATH_MODELS_DOCKER \
--name $MY_CONTAINER $NAME_IMAGE /bin/bash
else
sudo docker start $MY_CONTAINER
sudo docker exec -ti $MY_CONTAINER /bin/bash
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qmgps/dev-env-ubuntu.git
git@gitee.com:qmgps/dev-env-ubuntu.git
qmgps
dev-env-ubuntu
dev-env-ubuntu
master

搜索帮助