-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_docker.sh
58 lines (47 loc) · 2.65 KB
/
install_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
52
53
54
55
56
57
58
#!/bin/bash
# **************************************************************************** #
# #
# ::: :::::::: #
# init_docker.sh :+: :+: :+: #
# +:+ +:+ +:+ #
# By: aguiot-- <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/11/18 08:17:08 by aguiot-- #+# #+# #
# Updated: 2019/11/20 10:24:38 by aguiot-- ### ########.fr #
# #
# **************************************************************************** #
# https://github.com/alexandregv/42toolbox
# Ensure USER variabe is set
[ -z "${USER}" ] && export USER=`vmoreau`
################################################################################
# Config
docker_destination="/goinfre/$USER/docker" #=> Select docker destination (goinfre is a good choice)
################################################################################
# Uninstall docker, docker-compose and docker-machine if they are installed with brew
brew uninstall -f docker docker-compose docker-machine ;:
# Check if Docker is installed with MSC and open MSC if not
if [ ! -d "/Applications/Docker.app" ] && [ ! -d "~/Applications/Docker.app" ]; then
echo $'\033[0;34m'Please install $'\033[1;96m'Docker for Mac $'\033[0;34m'from the MSC \(Managed Software Center\)$'\033[0;39m'
open -a "Managed Software Center"
read -p $'\033[0;34m'Press\ RETURN\ when\ you\ have\ successfully\ installed\ $'\033[1;96m'Docker\ for\ Mac$'\033[0;34m'...$'\033[0;39m'
fi
function rm_and_link() {
rm -rf ~/Library/Containers/com.docker.docker ~/.docker
mkdir -p $docker_destination/{com.docker.docker,.docker}
ln -sf $docker_destination/com.docker.docker ~/Library/Containers/com.docker.docker
ln -sf $docker_destination/.docker ~/.docker
}
# Kill Docker if started
pkill Docker
# Create needed files in destination and make symlinks
if [ -d $docker_destination ]; then
read -p $'\033[0;34m'Folder\ $'\033[1;96m'$docker_destination$'\033[0;34m'\ already\ exists,\ \d\o\ you\ want\ to\ reset\ it?\ [y/$'\033[1;96m'N$'\033[0;34m']$'\033[0;39m'\ input
if [ -n "$input" ] && [ "$input" = "y" ]; then
rm_and_link
fi
else
rm_and_link
fi
# Start Docker for Mac
open -g -a Docker
echo $'\033[1;96m'Docker$'\033[0;34m' is now starting\! Please report any bug to: $'\033[1m'aguiot--$'\033[0;39m'