Commit cb1130f5 authored by tianye's avatar tianye

新增离线安装docker

parent 0f769b78
......@@ -11,6 +11,15 @@ function install_docker(){
echo -e "\033[32m检测到 Docker 已安装,跳过安装步骤\033[0m"
echo -e "\033[32m启动 Docker\033[0m "
service docker start 2>&1
else
if [[ -d docker ]]; then
echo -e "\033[32m正在离线安装 docker\033[0m"
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
echo -e "\033[32m启动 docker\033[0m"
service docker start 2>&1 | tee -a ${__current_dir}/install.log
else
echo -e "\033[32m在线安装 docker\033[0m"
curl -fsSL https://get.docker.com -o get-docker.sh 2>&1
......@@ -18,16 +27,23 @@ function install_docker(){
echo -e "\033[32m启动 docker...\033[0m"
service docker start 2>&1
fi
fi
}
function install_docker_compose(){
if which docker-compose >/dev/null; then
echo -e "\033[32m检测到 Docker Compose 已安装,跳过安装步骤\033[0m"
else
if [[ -d docker ]]; then
echo -e "\033[32m正在离线安装 docker-compose\033[0m"
cp docker/bin/docker-compose /usr/bin/
chmod +x /usr/bin/docker-compose
else
echo -e "\033[32m在线安装 docker-compose\033[0m"
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
# 检查docker-compose是否正
docker-compose version 1>/dev/null 2>/dev/null
if [ $? != 0 ];then
......
[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
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