Skip to content

Instantly share code, notes, and snippets.

@fanpero87
Last active February 10, 2023 04:06
Show Gist options
  • Save fanpero87/d3afdfdde418f4ab5997f3eae21d4e12 to your computer and use it in GitHub Desktop.
Save fanpero87/d3afdfdde418f4ab5997f3eae21d4e12 to your computer and use it in GitHub Desktop.
Docker Installation on Ubuntu
#!/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
@fanpero87
Copy link
Author

fanpero87 commented Jan 25, 2022

Make the file executable

$ sudo chmod u+x docker-install.sh

Run file

$ ./docker-install.sh

Test your installation

$ docker -v
$ docker-compose --version

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