docker之portainer搭建

1.安装docker
sudo yum install docker
2.需要使用到htpasswd命令创建密码,故需安装相关组件。
yum install httpd-tools -y
htpasswd -nb -B admin 3.参照以下文档,进行配置:
https://portainer.readthedocs.io/en/stable/configuration.html
4.编写简单的运行脚本

#!/bin/sh

mode=$1

dockerd_current=`ps -ef | grep "dockerd-current"| grep -v grep`
portainer=`ps -ef | grep "portainer --admin-password"| grep -v grep`

case "$mode" in
   'start')
	echo "it's ready to start op...."
	if test -n "$dockerd_current"; then
		echo "---the docker.service had already started.."
	else
		`sudo systemctl start docker.service`
	fi

	if test -n "$portainer"; then
		echo "---the portainer had already started.."
	else
		`sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer --admin-password '$2y$05$iOIorOhtjjymgIQT2x2n4.HWAUHCCV0QpvOdKkhJR2t9.s61O3uAe'`
	fi
	echo 'success to start.'
	echo '---1--you can test portainer by way bellow----'
	echo 'http://localhost:9000'
	echo 'user:admin   password:123456'
	;;
   'stop')
	echo "it's ready to check process..."
	`sudo systemctl stop docker.service`
	echo 'success to kill.'
	;;
    *)
	basename=`basename "$0"`
	echo "Usage: $basename  {start|stop}  [ portainer server options ]"
	exit 1
	;;
esac
exit 1