install.fairie/home/.chezmoiscripts/_universal/run_onchange_before_11-install-docker.tmpl
Brian Zalewski 6c95c870b0 Update 28 files
- /home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl
- /home/.chezmoiscripts/universal/run_before_01-decrypt-age-key.tmpl
- /home/.chezmoiscripts/ubuntu/run_onchange_before_10-install-ubuntu-dependencies.tmpl
- /home/.chezmoiscripts/qubes/run_onchange_before_12-update-dom0.tmpl
- /home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_10-system-tweaks.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_11-configure-swap.tmpl
- /home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl
- /home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl
- /home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_before_10-install-darwin-dependencies.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_before_20-ensure-user-group.tmpl
- /home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl
- /home/.chezmoiscripts/archlinux/run_onchange_before_10-install-archlinux-dependencies.tmpl
- /home/.chezmoiscripts/_universal/run_onchange_before_08-install-zx.tmpl
- /home/.chezmoiscripts/_universal/run_onchange_before_09-ensure-node-version.tmpl
- /home/.chezmoiscripts/_universal/run_onchange_before_10-remove-bloatware.tmpl
- /home/.chezmoiscripts/_universal/run_onchange_before_11-install-docker.tmpl
- /home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl
- /home/.chezmoiscripts/_universal/run_before_01-add-temporary-includes.tmpl
- /home/.chezmoitemplates/universal/logg
- /home/.chezmoitemplates/universal/profile
- /home/.chezmoitemplates/universal/profile-before
- /home/.chezmoitemplates/universal/logg-before
- /home/.chezmoitemplates/universal/logg-compat
- /home/.chezmoitemplates/universal/logg-inline
- /home/.chezmoitemplates/universal/profile-inline
- /home/.chezmoidata.yaml
2023-01-25 04:31:32 +00:00

106 lines
4.2 KiB
Cheetah

{{- if ne .host.distro.family "windows" -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile-bundle" }}
{{ includeTemplate "universal/logg-bundle" }}
### Install Docker
if [ -d /Applications ] && [ -d /System ]; then
# macOS
logg info 'Installing Docker on macOS via Homebrew cask'
brew install --cask docker
logg info 'Opening the Docker for Desktop app so that the Docker engine starts running'
open --background -a Docker
elif command -v apt-get > /dev/null; then
. /etc/os-release
if [ "$ID" == 'ubuntu' ]; then
logg info 'Installing Docker on Ubuntu'
else
logg info 'Installing Docker on Debian'
fi
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL "https://download.docker.com/linux/$ID/gpg" | sudo gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
sudo 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/$ID $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
elif command -v dnf > /dev/null; then
# Fedora
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
elif command -v yum > /dev/null; then
# CentOS
logg info 'Installing Docker on CentOS'
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
elif command -v apk > /dev/null; then
# Alpine
logg info 'Installing Docker on Alpine'
sudo apk add --update docker
elif command -v pacman > /dev/null; then
# Archlinux
logg info 'Installing Docker on Archlinux'
sudo pacman -Syu
sudo pacman -S docker
elif command -v zypper > /dev/null; then
# OpenSUSE
logg info 'Installing Docker on OpenSUSE'
sudo zypper addrepo https://download.docker.com/linux/sles/docker-ce.repo
sudo zypper install docker-ce docker-ce-cli containerd.io docker-compose-plugin
fi
### Add Docker group on Linux
if command -v groupadd > /dev/null; then
# Linux
if ! cat /etc/group | grep docker > /dev/null; then
logg info 'Creating Docker group'
sudo groupadd docker
fi
logg info 'Adding user to Docker group'
sudo usermod -aG docker "$USER"
fi
### Boot Docker on start with systemd on Linux machines
if command -v systemctl > /dev/null; then
# Systemd Linux
sudo systemctl start docker.service
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
fi
### Add gVisor
if [ ! -d /Applications ] || [ ! -d /System ]; then
# Linux
if ! command -v runsc > /dev/null; then
# Install gVisor
logg info 'Building gVisor from source'
if [ -d /usr/local/src/gvisor ]; then
logg info 'Removing stale directory /usr/local/src/gvisor'
sudo rm -rf /usr/local/src/gvisor
fi
sudo git clone https://github.com/google/gvisor.git /usr/local/src/gvisor
cd /usr/local/src/gvisor
sudo mkdir -p bin
sudo make copy TARGETS=runsc DESTINATION=bin/
sudo cp ./bin/runsc /usr/local/bin
fi
if [ ! -f /etc/docker/daemon.json ]; then
# Configure Docker to use gVisor
# Create /etc/docker/daemon.json
logg info 'Creating /etc/docker'
sudo mkdir -p /etc/docker
if [ -f /usr/local/src/install.doctor/home/private_dot_config/docker/daemon.json ]; then
logg info 'Creating /etc/docker/daemon.json'
sudo cp "/usr/local/src/install.doctor/home/private_dot_config/docker/daemon.json" /etc/docker/daemon.json
else
logg warn '/usr/local/src/install.doctor/home/private_dot_config/docker/daemon.json is not available so the /etc/docker/daemon.json file cannot be populated'
fi
fi
fi
{{ end -}}