Last active
September 26, 2022 06:33
-
-
Save noob-master147/f96aef074bf28d1db7276e365b646ba5 to your computer and use it in GitHub Desktop.
Setup Docker and Docker-Compose on AWS EC2
This file contains 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/bash | |
# Docker | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
sudo apt-get install -y docker-ce -y | |
# Docker Compose | |
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
# nginx | |
sudo apt install nginx -y | |
sudo ufw allow 'Nginx HTTP' | |
# sudo nginx -t | |
# sudo systemctl restart nginx | |
# Post docker config | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
newgrp docker | |
# setup up alias | |
sudo echo -e "\n# DOCKER ALISES \nalias dc='docker-compose' \nalias dcd='docker-compose down' \nalias dcp='docker-compose pull' \nalias dcu-b='docker-compose up --build' \nalias dcu='docker-compose up' \nalias dcu-d='docker-compose up -d' \nalias dcu-db='docker-compose up --build -d' \nalias dcu-bd='docker-compose up --build -d' \nalias dps='docker ps' \nalias dcp='docker-compose pull'" >> ~/.bashrc | |
source .bashrc | |
sudo reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment