Last active
February 10, 2023 04:06
-
-
Save fanpero87/d3afdfdde418f4ab5997f3eae21d4e12 to your computer and use it in GitHub Desktop.
Docker Installation on Ubuntu
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 | |
# Install Docker for Ubuntu | |
sudo apt update | |
sudo apt install -y \ | |
ca-certificates \ | |
curl \ | |
gnupg \ | |
lsb-release | |
sudo mkdir -m 0755 -p /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
echo \ | |
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt update | |
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
# Install Docker Compose Ubuntu | |
curl -SL https://github.com/docker/compose/releases/download/v2.15.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose | |
chmod +x ~/.docker/cli-plugins/docker-compose | |
# Manage Docker as a non-root user | |
sudo usermod -aG docker $USER | |
# Reload Docker to apply changes | |
newgrp docker |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make the file executable
$ sudo chmod u+x docker-install.sh
Run file
$ ./docker-install.sh
Test your installation
$ docker -v
$ docker-compose --version