-
Notifications
You must be signed in to change notification settings - Fork 388
/
docker.sh
52 lines (39 loc) · 1.14 KB
/
docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
dockerVer="${1:-20.10.24}"
rm -rf /usr/bin/docker-init
rm -rf /usr/bin/containerd
rm -rf /usr/bin/ctr
rm -rf /usr/bin/runc
rm -rf /usr/bin/dockerd
rm -rf /usr/bin/docker-proxy
rm -rf /usr/bin/containerd-shim
rm -rf /usr/bin/docker
rm -rf /usr/bin/containerd-shim-runc-v2
rm -rf /etc/systemd/system/docker.service
rm -rf /var/lib/docker
rm -rf /etc/docker
ps -C dockerd -o pid= |xargs kill -9 >/dev/null 2>&1
[ "$dockerVer" == "0" ] && exit 0
case `uname -m` in aarch64|arm64) arch="aarch64";; x86_64|amd64) arch="x86_64";; *) arch="";; esac
[ -n "$arch" ] || exit 1
wget --no-check-certificate -4 -qO- "https://download.docker.com/linux/static/stable/${arch}/docker-${dockerVer}.tgz" |tar -xzv --strip-components=1 -C /usr/bin
[ $? -eq 0 ] || exit 1
cat >/etc/systemd/system/docker.service<<EOF
[Unit]
Description=docker
After=local-fs.target network.target
[Service]
Type=simple
ExecStart=/usr/bin/dockerd
KillMode=process
KillSignal=SIGINT
TimeoutStopSec=3
Restart=always
RestartSec=1s
[Install]
WantedBy=multi-user.target
EOF
systemctl disable docker 2>/dev/null
systemctl daemon-reload
systemctl enable docker
systemctl restart docker