Forked from UbuntuEvangelist/Docker and Docker Compose Install
Created
July 5, 2021 16:51
-
-
Save LinuxFintech/bfc456f8b73ee87c7afe0c0ef1a2c704 to your computer and use it in GitHub Desktop.
Docker and Docker Compose Install Ubuntu 20.04 LTS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
apt update -y | |
apt-get upgrade -y | |
apt install build-essential checkinstall | |
apt install ubuntu-restricted-extras | |
apt install software-properties-common | |
apt upgrade -o APT::Get::Show-Upgraded=true | |
apt-show-versions | grep upgradeable | |
apt install apt-show-versions | |
apt update -y | |
apt-get upgrade -y | |
add-apt-repository ppa:nilarimogard/webupd8 | |
apt update -y | |
apt install launchpad-getkeys | |
launchpad-getkeys | |
add-apt-repository ppa:git-core/ppa | |
apt update -y | |
apt install git | |
git config --global user.name "masum" | |
git config --global user.email [email protected] | |
apt upgrade -y | |
ssh-keygen -t rsa -b 4096 -C "[email protected]" | |
eval "$(ssh-agent -s)" | |
ssh-add ~/.ssh/id_rsa | |
cat /root/.ssh/id_rsa.pub | |
# add your KEY to github and gitlab SSH | |
####### Enable SSH ######## | |
apt-get install openssh-server | |
nano /etc/ssh/sshd_config | |
# Find (ctrl+w) this line and set | |
PermitRootLogin yes | |
PubkeyAuthentication yes | |
PasswordAuthentication yes | |
# Save & exit ctrl+s and ctrl+x then hit enter | |
service ssh restart | |
apt -f install | |
apt autoremove | |
apt -y autoclean | |
apt -y clean | |
apt update | |
reboot | |
# Docker Install | |
apt-get update -y | |
apt-get upgrade -y | |
apt-get install apt-transport-https ca-certificates curl software-properties-common -y | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - | |
add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" | |
apt-get update -y | |
apt install docker-ce -y | |
systemctl start docker | |
systemctl enable docker | |
usermod -aG docker ${USER} | |
systemctl restart docker | |
systemctl status docker | |
docker --version | |
# Docker Compose Install | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose | |
apt-get update -y | |
apt-get upgrade -y | |
docker-compose --version | |
###########Docker Image Stop and Delete########################### | |
List all containers (only IDs) | |
$ docker ps -aq | |
Stop all running containers. | |
$ docker stop $(docker ps -aq) | |
Remove all containers. | |
$ docker rm $(docker ps -aq) | |
Remove all images. | |
$ docker rmi $(docker images -q) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment