Skip to content

Instantly share code, notes, and snippets.

@eins78
Last active June 16, 2022 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eins78/211642cbd7cd616a70dd4756ee66bbe6 to your computer and use it in GitHub Desktop.
Save eins78/211642cbd7cd616a70dd4756ee66bbe6 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -exu
apt-get purge -y docker docker-engine docker.io containerd runc
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
apt-get update
apt-get 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
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-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
docker run hello-world
usermod -aG docker ci-exec-user
cat << 'EOF' > /etc/systemd/system/docker-cleanup.service
[Unit]
Description=Docker cleanup
[Service]
Type=oneshot
ExecStart=/bin/bash -c 'docker system prune --force --all --volumes'
EOF
cat << 'EOF' > /etc/systemd/system/docker-cleanup.timer
[Unit]
Description=Docker cleanup on Reboot
[Timer]
OnBootSec=1
[Install]
WantedBy=timers.target
EOF
systemctl enable docker-cleanup.timer
echo '- Docker Engine' >> /cider-ci/executor/config/traits.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment