1 Star 0 Fork 10

QMGPS/dev-env-ubuntu

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
load-image-ubuntu-dev.sh 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
kang 提交于 2021-10-29 20:31 . support 16.04&18.04
#!/bin/bash
set -e
# -------------------------------------------------------------------------------
# Filename: load-image-ubuntu-dev.sh
# UpdateDate: 2021/09/27
# Description: Loading docker image for IDE.
# Example:
# ./load-image-ubuntu-dev.sh
# ./load-image-ubuntu-dev.sh 16.04
# ./load-image-ubuntu-dev.sh 18.04
# Depends: image-$OS-$PATH_WORK-$VERSION.tar.gz
# Notes:
# -------------------------------------------------------------------------------
#Dockerfile(16.04/18.04/CentOS)
OSVer="16.04"
if [[ $# -ne 0 ]];then OSVer="${1}";fi
# Source env
source ./env.sh $OSVer
#################### main ####################
# 0.Check param
#if [[ $# -eq 0 ]];then
# echo -e "${yellow}WARNING: Load images(${FULLNAME_IMAGE}) by default. ${none}"
#else
# FULLNAME_IMAGE="${1}"
#fi
# 0.Check File Images
if [[ ! -f ${FULLNAME_IMAGE} ]]; then
echo -e "${red}ERROR: Images(${FULLNAME_IMAGE}) does not exist! ${none}" && exit -1
fi
if [[ ! ${FULLNAME_IMAGE} =~ ${FILENAME_IMAGE} ]]; then
echo -e "${red}ERROR: Images(${FULLNAME_IMAGE}), please use images(fileName:${FILENAME_IMAGE})! ${none}" && exit -1
fi
# 0.Check Docker Images
num=`sudo docker images | grep -w "$MY_IMAGE" | grep -w "$VERSION" | wc -l`
echo $num
echo $NAME_IMAGE
# 1.Load Docker Images
if [ 0 -eq $num ];then
echo "The image($NAME_IMAGE) is not loaded and is loading......"
#load image
sudo docker load < ${FULLNAME_IMAGE}
else
echo "The image($NAME_IMAGE) is already loaded!"
fi
#echo "All image information:"
#sudo docker images
echo "The image($NAME_IMAGE) information:"
sudo docker images | grep -e "REPOSITORY" -e $MY_IMAGE
马建仓 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

搜索帮助