Skip to content

Instantly share code, notes, and snippets.

@islishude
Last active January 31, 2024 08:37
Show Gist options
  • Save islishude/d3f63d14a1867ca1bd870df0be163124 to your computer and use it in GitHub Desktop.
Save islishude/d3f63d14a1867ca1bd870df0be163124 to your computer and use it in GitHub Desktop.
Install latest docker on ubuntu
#!/usr/bin/env bash
set -eux
set -o pipefail
# Add Docker's official GPG key:
apt-get update -y
apt-get install ca-certificates curl jq -y
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update -y
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Add ubuntu user to docker group
usermod -aG docker ubuntu
# Add docker-compose
DOCKER_COMPOSE_VERSION=`curl -sSL -H 'Accept: application/json' https://github.com/docker/compose/releases/latest | jq -r .tag_name`
curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-`uname -m`" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment