Skip to content

Instantly share code, notes, and snippets.

@arainho
Last active July 13, 2020 13:17
Show Gist options
  • Save arainho/ea1b8eaa967e1648eb140f86cdc16440 to your computer and use it in GitHub Desktop.
Save arainho/ea1b8eaa967e1648eb140f86cdc16440 to your computer and use it in GitHub Desktop.
install docker - debian
#!/usr/bin/env bash
# Setup docker and docker-compose ( no prompts )
### Uninstall old versions ###################################################
sudo apt-get -y remove docker docker-engine docker.io containerd runc
### SET UP THE REPOSITORY ###################################################
# Update the apt package index
sudo apt-get -y update
# Install packages to allow apt to use a repository over HTTPS:
sudo apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
# Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.
sudo apt-key fingerprint 0EBFCD88
# Use the following command to set up the stable repository. You always need the stable repository, even if you want to install builds from the edge or test repositories as well.
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
### INSTALL DOCKER CE ###########################################################################
# Update the apt package index.
sudo apt-get -y update
# Install the latest version of Docker CE, or go to the next step to install a specific version:
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Verify that Docker CE is installed correctly by running the hello-world image.
docker run hello-world | grep "Hello from Docker!"
### INSTALL DOCKER COMPOSE ###########################################################################
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Test the installation.
docker-compose --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment