#!/bin/bash
# ./docker_restart_public.sh keyfunc.tencentcloudcr.com/prod/mdx:bcdf170 /EPM2/POSTGRE
set -x
DOCKER_IMAGE_NAME=$1
MDX_DATA=$2
MDX_NAME=$3
MDX_PORT=$4

docker ps -a | tail -n+2 | grep $MDX_NAME | awk '{print $1}' | xargs docker stop
docker ps -a | tail -n+2 | grep $MDX_NAME |awk '{print $1}' | xargs docker rm
echo "docker del done,start docker"
#docker run -d --name mdx_only1 --restart=always --ulimit stack=102400:102400 -v /data_disk/pg_data/mdx/config.json:/home/mdx/config.json -p 9010:9019 keyfunc.tencentcloudcr.com/test/mdx:667b1ed
docker run -d --name $MDX_NAME --restart=always --ulimit stack=-1 -v ${MDX_DATA}:/tmp -v ${MDX_DATA}/config.json:/home/mdx/config.json -p $MDX_PORT:9019 ${DOCKER_IMAGE_NAME}