Install docker from official source, not apt. Add docker compose

This commit is contained in:
2026-06-05 22:43:02 +02:00
parent 0017cb73d5
commit 6c78dbf092
2 changed files with 78 additions and 4 deletions

View File

@@ -21,7 +21,7 @@ cd ~/server_cli_tools
| 2 | **Zsh + Oh-My-Zsh** | Shell, plugins (`zsh-autosuggestions`, `zsh-syntax-highlighting`, `z`), `bira` prompt theme | | 2 | **Zsh + Oh-My-Zsh** | Shell, plugins (`zsh-autosuggestions`, `zsh-syntax-highlighting`, `z`), `bira` prompt theme |
| 3 | **Aliases + tools** | General, git, and docker aliases with a self-documenting help system (`h`) | | 3 | **Aliases + tools** | General, git, and docker aliases with a self-documenting help system (`h`) |
| 4 | **Terminal configs** | `bat` theme (base16) | | 4 | **Terminal configs** | `bat` theme (base16) |
| 5 | **Docker** | `docker.io` via apt, service enabled, user added to `docker` group, management aliases | | 5 | **Docker** | Docker Engine + Compose from [Docker's official apt repo](https://docs.docker.com/engine/install/ubuntu/) (`docker-ce`, `docker-compose-plugin`), service enabled, user added to `docker` group, management aliases |
| 6 | **Git config** | `git-delta` as pager with side-by-side diffs | | 6 | **Git config** | `git-delta` as pager with side-by-side diffs |
> **NOTE:** There's minimal custom theme in `<repo>/configs/zsh/zhann-elvis.zsh-theme`. To apply it toggle `ZSH_THEME` and uncomment sourcing it in `~/.zshrc` after install. > **NOTE:** There's minimal custom theme in `<repo>/configs/zsh/zhann-elvis.zsh-theme`. To apply it toggle `ZSH_THEME` and uncomment sourcing it in `~/.zshrc` after install.

View File

@@ -221,8 +221,82 @@ install_terminal_configs() {
install_docker() { install_docker() {
e_info "\n[5/6] Docker" e_info "\n[5/6] Docker"
sudo apt-get update -qq local docker_packages=(
apt_install docker.io docker-ce
docker-ce-cli
containerd.io
docker-buildx-plugin
docker-compose-plugin
)
if dpkg -s docker-ce &>/dev/null; then
e_info " Docker Engine (official) is already installed"
else
e_info " Installing Docker Engine from Docker's official apt repository..."
# https://docs.docker.com/engine/install/ubuntu/
local conflicting=(docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc)
local to_remove=()
for pkg in "${conflicting[@]}"; do
if dpkg -s "$pkg" &>/dev/null; then
to_remove+=("$pkg")
fi
done
if [ ${#to_remove[@]} -gt 0 ]; then
e_warn " Removing conflicting packages: ${to_remove[*]}"
sudo apt-get remove -y "${to_remove[@]}"
fi
. /etc/os-release
local docker_distro suite
case "$ID" in
ubuntu)
docker_distro=ubuntu
suite="${UBUNTU_CODENAME:-$VERSION_CODENAME}"
;;
debian)
docker_distro=debian
suite="$VERSION_CODENAME"
;;
*)
e_warn " Unsupported distro for Docker install ($ID) — skipping engine install"
docker_distro=
;;
esac
if [ -n "$docker_distro" ]; then
apt_install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
if [ ! -f /etc/apt/keyrings/docker.asc ]; then
sudo curl -fsSL "https://download.docker.com/linux/$docker_distro/gpg" -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
fi
if [ ! -f /etc/apt/sources.list.d/docker.sources ]; then
sudo tee /etc/apt/sources.list.d/docker.sources >/dev/null <<EOF
Types: deb
URIs: https://download.docker.com/linux/$docker_distro
Suites: $suite
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
fi
sudo apt-get update -qq
apt_install "${docker_packages[@]}"
fi
fi
if ! dpkg -s docker-compose-plugin &>/dev/null; then
sudo apt-get update -qq
apt_install docker-compose-plugin
fi
if command_exists docker && docker compose version &>/dev/null; then
e_info " Docker Compose plugin is available ($(docker compose version --short 2>/dev/null || docker compose version))"
fi
if command_exists systemctl; then if command_exists systemctl; then
sudo systemctl enable --now docker 2>/dev/null || sudo systemctl enable --now docker 2>/dev/null ||
@@ -397,7 +471,7 @@ COMPONENTS=(
"Zsh + Oh-My-Zsh (shell, plugins)" "Zsh + Oh-My-Zsh (shell, plugins)"
"Aliases + custom tools" "Aliases + custom tools"
"Terminal configs (bat)" "Terminal configs (bat)"
"Docker (engine + aliases)" "Docker (engine + compose + aliases)"
"Git config (delta pager)" "Git config (delta pager)"
) )