forked from citizen63000/tp-mongodb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-docker.sh
31 lines (25 loc) · 1.2 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
#!/bin/bash
if [ `id -u` -ne 0 ] ;
then echo "Please run this script with root privileges"
exit 1
fi
# source : https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04
apt-get update
apt-get remove docker docker-engine docker.io containerd runc
# Next, install a few prerequisite packages which let apt use packages over HTTPS:
apt-get install apt-transport-https ca-certificates curl gnupg lsb-release software-properties-common -y
# Then add the GPG key for the official Docker repository to your system:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Add the Docker repository to APT sources:
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# This will also update our package database with the Docker packages from the newly added repo.
# Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:
apt-get install docker-ce docker-ce-cli containerd.io docker-compose -y
usermod -aG docker lionel
newgrp docker
# set for elasticsearch
sysctl -w vm.max_map_count=262144
# set for redis
sysctl vm.overcommit_memory=1
# test docker
docker run hello-world