#!/bin/sh
echo '1-开始安装docker'
echo '解压tar包...'
tar -xvf docker-19.03.6.tgz
echo '将docker目录移动/usr/bin 目录下...'
mv docker/* /usr/bin
rm -rf docker
echo '新建docker.service 移到 /etc/systemd/system/ 目录...'
touch /etc/systemd/system/docker.service
echo "[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
" >> /etc/systemd/system/docker.service
echo '添加文件权限...'
chmod +x /etc/systemd/system/docker.service
echo '重新加载配置文件...'
systemctl daemon-reload
echo '启动docker...'
systemctl start docker
echo '设置开机自启...'
systemctl enable docker.service
echo 'docker安装成功...'
docker -v
systemctl status docker
echo '2-开始安装docker-compose'
sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose -v
echo 'docker-compose安装成功...'
echo '3-开始导入docker 镜像包'
echo '导入JDK1.8镜像包'
docker load < java.tar
echo '导入tomcat镜像包'
docker load < tomcat.tar
echo '导入mysql5.7.28镜像包'
docker load < mysql5.7.28.tar
echo '导入nginx镜像包'
docker load < nginx.tar
echo '导入redis镜像包'
docker load < redis.tar