Created
November 13, 2023 15:49
-
-
Save xtetsuji/581bfecc28d7d56464bfd712761cdb12 to your computer and use it in GitHub Desktop.
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 | |
# https://docs.docker.com/engine/install/ubuntu/ | |
set -eu | |
# root でなかったら終了 | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root." 1>&2 | |
exit 1 | |
fi | |
# Ubuntu でなかったら終了 | |
# Debian であっても終了 | |
if ! grep -q Ubuntu /etc/os-release; then | |
echo "This script must be run on Ubuntu." 1>&2 | |
exit 1 | |
fi | |
apt purge docker | |
apt install -y ca-certificates curl gnupg lsb-release | |
mkdir -p /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
chmod a+r /etc/apt/keyrings/docker.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
apt update | |
apt install -y docker-ce docker-ce-cli containerd.io | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ubuntu moby-cli package brings
/usr/bin/docker
too, but this script purge docker package only. Is it safe?(ja: Ubuntu の moby-cli パッケージも
/usr/bin/docker
を配置するんだけど、このスクリプトではサポートしていないの、大丈夫だろうか)