Commit d69a17de authored by wenlong's avatar wenlong

增加安装docker及docker-compose脚本

parent 8d0fcedb
Pipeline #75509 canceled with stages
...@@ -7,6 +7,10 @@ This folder containing scripts and Docker Compose configurations to run ThingsBo ...@@ -7,6 +7,10 @@ This folder containing scripts and Docker Compose configurations to run ThingsBo
ThingsBoard Microservices are running in dockerized environment. ThingsBoard Microservices are running in dockerized environment.
Before starting please make sure [Docker CE](https://docs.docker.com/install/) and [Docker Compose](https://docs.docker.com/compose/install/) are installed in your system. Before starting please make sure [Docker CE](https://docs.docker.com/install/) and [Docker Compose](https://docs.docker.com/compose/install/) are installed in your system.
`
$ ./install-docker.sh
`
## Installation ## Installation
Before performing initial installation you can configure the type of database to be used with ThingsBoard. Before performing initial installation you can configure the type of database to be used with ThingsBoard.
......
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
#!/bin/bash
function log() {
message="[Docker-Install Log]: $1 "
echo -e "${message}" 2>&1
}
#Install docker & docker-compose
##Install Latest Stable Docker Release
if which docker >/dev/null; then
log "检测到 Docker 已安装,跳过安装步骤"
log "启动 Docker "
service docker start 2>&1
else
if [[ -d docker ]]; then
log "... 离线安装 docker"
cp docker/bin/* /usr/bin/
cp docker/service/docker.service /etc/systemd/system/
chmod +x /usr/bin/docker*
chmod 754 /etc/systemd/system/docker.service
log "... 启动 docker"
service docker start 2>&1
else
log "... 在线安装 docker"
curl -fsSL https://get.docker.com -o get-docker.sh 2>&1
sudo sh get-docker.sh --mirror Aliyun 2>&1
log "... 启动 docker"
service docker start 2>&1
fi
fi
# 检查docker服务是否正常运行
docker ps 1>/dev/null 2>/dev/null
if [ $? != 0 ];then
log "Docker 未正常启动,请先安装并启动 Docker 服务后再次执行本脚本"
exit
fi
##Install Latest Stable Docker Compose Release
if which docker-compose >/dev/null; then
log "检测到 Docker Compose 已安装,跳过安装步骤"
else
if [[ -d docker ]]; then
log "... 离线安装 docker-compose"
cp docker/bin/docker-compose /usr/bin/
chmod +x /usr/bin/docker-compose
else
log "... 在线安装 docker-compose"
curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose 2>&1
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
fi
fi
\ No newline at end of file
File mode changed from 100644 to 100755
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment