#!/usr/bin/env bash
Data_File="/data/disk/gitlab"
Docker_images_name="gitlab"
Gitlab_version="14.6.3"
docker pull gitlab/gitlab-ce:${Gitlab_version}-ce.0
docker rm -f ${Docker_images_name}
docker run -d --name ${Docker_images_name} \
--restart always \
-p 10443:443 \
-p 1080:1080 \
-p 10022:22 \
-v ${Data_File}/config:/etc/gitlab \
-v ${Data_File}/logs:/var/log/gitlab \
-v ${Data_File}/data:/var/opt/gitlab \
-v ${Data_File}/gitlab-back:/gitlab-back \
-v ${Data_File}/gitlab-data:/gitlab-data \
gitlab/gitlab-ce:${Gitlab_version}-ce.0
#!/usr/bin/env bash
Data_File="/data/disk/gitlab"
Docker_images_name="gitlab"
Gitlab_version="14.9.3-ce.0"
function docker_pull(){
docker pull gitlab/gitlab-ce:${Gitlab_version}-ce.0
}
function docker_rm(){
docker rm -f ${Docker_images_name}
}
function docker_rmi(){
docker stop ${Docker_images_name}
docker rm -f ${Docker_images_name}
docker rmi gitlab/gitlab-ce:${Gitlab_version}
}
function docker_run(){
docker run -d --name ${Docker_images_name} \
--restart always \
-p 10443:443 \
-p 1080:1080 \
-p 10022:22 \
-v ${Data_File}/config:/etc/gitlab \
-v ${Data_File}/logs:/var/log/gitlab \
-v ${Data_File}/data:/var/opt/gitlab \
-v ${Data_File}/gitlab-back:/gitlab-back \
-v ${Data_File}/gitlab-data:/gitlab-data \
gitlab/gitlab-ce:${Gitlab_version}
}
function docker_file_clean(){
echo "rm ${Data_File}"
echo "mkdir ${Data_File}"
}
case $1 in
"start")
echo "镜像启动中..."
docker start ${Docker_images_name}
;;
"stop")
echo "镜像停止中..."
docker stop ${Docker_images_name}
;;
"restart")
echo "镜像重启中..."
docker restart ${Docker_images_name}
;;
"update")
echo "重新部署中..."
docker_pull
docker_rm
docker_run
;;
"reset")
echo "Gitlab重置中..."
docker_rmi
docker_file_clean
docker_pull
docker_rm
docker_run
;;
*)
echo "请输入参数..."
;;
esac