在测试过程中,可能需要arm64版本的docker环境,下面是启动arm64版本docker shell脚本:
#/bin/bash
docker run --rm --privileged multiarch/qemu-user-static:register
if [ ! -n "$1" ] ;then
echo "You should input container name !!!"
MY_CONTAINER="test"
else
echo "The container name is $1"
MY_CONTAINER="$1"
fi
if [ ! -n "$2" ] ;then
echo "You should input image name !!!"
return
else
echo "The image name is $2"
image="$2"
fi
export MY_CONTAINER
num=`sudo docker ps -a|grep "$MY_CONTAINER"|wc -l`
echo $num
echo $MY_CONTAINER
if [ 0 -eq $num ];then
sudo xhost +
sudo docker run -e DISPLAY=unix$DISPLAY --pid=host -v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static -it --privileged --name $MY_CONTAINER -v $PWD/../:/home/workspace $image /bin/bash
else
sudo docker start $MY_CONTAINER
sudo docker exec -ti $MY_CONTAINER /bin/bash
fi