-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker
More file actions
executable file
·35 lines (30 loc) · 968 Bytes
/
docker
File metadata and controls
executable file
·35 lines (30 loc) · 968 Bytes
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
#!/bin/bash
if [ $# -eq 0 ]; then
echo "you must specify the user"
exit
fi
PROMPT_MSG="Press any enter to continue or Ctrl+C to terminate "
printf "Adding new PGP key..\n"
read -p "$PROMPT_MSG"
apt-get update
apt-get install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
printf "Setting sources file..\n"
read -p "$PROMPT_MSG"
SOURCE_FILE=/etc/apt/sources.list.d/docker.list
if [ -e $SOURCE_FILE ]; then
echo Removing old sources file..
rm $SOURCE_FILE
fi
echo 'deb https://apt.dockerproject.org/repo debian-stretch main' > $SOURCE_FILE
printf "Installing docker..\n"
read -p "$PROMPT_MSG"
apt-get update
apt-cache policy docker-engine
apt-get install docker-engine
printf "Adding user $1 to docker group..\n"
read -p "$PROMPT_MSG"
gpasswd -a $1 docker
service docker restart
docker run hello-world
echo "******** Done - re-log the user $1! ********"