Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Docker and Nginx Deployment on Ubuntu Bionic/Focal, Debian Buster
# upgrades operating system
sudo apt-get update && sudo apt-get upgrade -y
# install docker latest
sudo apt remove docker docker-engine containerd runc # purging the legacy version if exists
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
sudo curl -fsSL | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
sudo apt update && sudo apt install docker-ce docker-ce-cli -y
# install docker-compose latest
# curl -SL -o docker-compose
curl -s \
| grep -v ".sha256" \
| grep browser_download_url \
| grep "docker-compose-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)" \
| cut -d '"' -f 4 \
| xargs curl -L -o docker-compose
chmod +x docker-compose
sudo mkdir -p /usr/local/lib/docker/cli-plugins
sudo mv docker-compose /usr/local/lib/docker/cli-plugins
# add the current non-root user to docker group
sudo groupadd -f docker
sudo usermod -aG docker $USER
sudo docker -v
sudo docker compose version
# install nginx latest
echo "
deb [arch=amd64] bionic nginx
deb-src bionic nginx
" | sudo tee /etc/apt/sources.list.d/nginx.list
sudo apt-key add nginx_signing.key
sudo apt update
sudo apt remove nginx nginx-common nginx-full nginx-core -y
sudo apt install nginx -y
rm *.sh *.key
echo -e "\e[32mPlease reboot your machine .. \e[0m"
Copy link

crazyoptimist commented Sep 18, 2020

Thanks to Aimeri Baddouh, docker compose latest version became free of hard-code, from his comment here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment