-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathinstall-docker.sh
More file actions
executable file
·70 lines (57 loc) · 1.67 KB
/
install-docker.sh
File metadata and controls
executable file
·70 lines (57 loc) · 1.67 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
echo
echo docker
echo will remove: docker docker-engine docker.io
echo then install: docker-ce
echo should you not want that, CTRL-C now, and execute the remaining commands in install.sh manually
echo
if [ "$1" == "ubuntu" ]; then
echo Your CLI switch: ubuntu
else
echo no CLI switch, thus using the Debian routine.
fi
echo
read -p "Press enter to continue"
echo
echo stopping docker daemon then
echo remove docker docker-engine docker.io
# possibly not installed, so switch off the trap:
set +e
sudo service docker stop
sudo apt-get -y remove docker docker-engine docker.io
set -e
echo
file=/etc/apt/sources.list.d/docker.list
if [ -f "$file" ]
then
echo making backup of $file because the following command will overwrite that!
sudo cp $file $file.save
fi
if [ "$1" == "ubuntu" ]; then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee $file
else
echo add docker debian gpg key:
# add key - how more elegant?
# rm -f gpg
# wget "https://download.docker.com/linux/debian/gpg"
# sudo apt-key add gpg
# rm gpg
curl https://download.docker.com/linux/debian/gpg | sudo apt-key add -
echo new $file
echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee $file
echo
fi
set +e
sudo apt-get update
set -e
echo
echo install docker-ce
sudo apt-cache policy docker-ce
sudo apt-get -y install docker-ce
echo add group docker to current user
sudo usermod -aG docker ${USER}
groups $USER
echo sudo service docker restart
sudo service docker restart
systemctl status docker --no-pager
docker --version