Skip to content

Instantly share code, notes, and snippets.

@cfra
Last active September 26, 2022 07:13
Show Gist options
  • Save cfra/d1bc8730eae955f413167f4ec5374d53 to your computer and use it in GitHub Desktop.
Save cfra/d1bc8730eae955f413167f4ec5374d53 to your computer and use it in GitHub Desktop.
How to setup Docker CE at Digitalocean with btrfs

Dropping the Docker

Based on this guide

We differ from the official docs by creating the btrfs before installing docker-ce.

Also we assume this is done as root.

Apperently, we can save ourself the effort to shuffle stuff around afterwards and have docker use the btrfs as intended, immediately after installation.

Creating Droplet

Size: 2GB RAM/40GB SSD Block Storage: New, 100 GB

Deinstall any existing old Docker

apt purge docker docker-engine docker.io

Create btrfs

On Debian

On debian, btrfs is not installed by default yet.

apt install btrfs-progs/stable

On all

mkfs.btrfs /dev/sda
echo '/dev/sda /var/lib/docker btrfs relatime 0 2' >> /etc/fstab
mkdir /var/lib/docker
mount /var/lib/docker

Install Docker

apt update
apt install \
   apt-transport-https \
   ca-certificates \
   curl \
   software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
apt-key fingerprint 0EBFCD88

Fingerprint should be 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88

Droplet is amd64.

On Debian, ubuntu needs to be replaced with debian in the next command

add-apt-repository \
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) \
  stable"
apt update
apt install docker-ce

To test:

docker run --rm -ti hello-world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment