35 lines
949 B
Bash
Executable File
35 lines
949 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [[ "${EUID}" -ne 0 ]]; then
|
|
echo "Run with sudo: sudo bash scripts/install-docker-ubuntu.sh" >&2
|
|
exit 1
|
|
fi
|
|
|
|
. /etc/os-release
|
|
if [[ "${ID}" != "ubuntu" ]]; then
|
|
echo "This installer supports Ubuntu only; detected ${ID}." >&2
|
|
exit 1
|
|
fi
|
|
|
|
apt-get update
|
|
apt-get install -y ca-certificates curl openssl python3
|
|
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
|
|
|
|
cat >/etc/apt/sources.list.d/docker.sources <<EOF
|
|
Types: deb
|
|
URIs: https://download.docker.com/linux/ubuntu
|
|
Suites: ${VERSION_CODENAME}
|
|
Components: stable
|
|
Architectures: $(dpkg --print-architecture)
|
|
Signed-By: /etc/apt/keyrings/docker.asc
|
|
EOF
|
|
|
|
apt-get update
|
|
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
|
systemctl enable --now docker
|
|
docker version
|
|
docker compose version
|