Install Docker with AUFS on Linode

The 30-minute Discourse installation guide assumes you’ll be using Digital Ocean and makes no mention of an important requirement for Docker:

If you use another hosting provider, you should really make sure that a Linux kernel feature called “AUFS” is supported. Docker not using AUFS can cause terrible pain.

If you want to use Linode, here’s how to enable AUFS support in Ubuntu (for other OSes, refer to Linode’s guide and update the instructions below accordingly:

  1. Create the Linode and pick Ubuntu 14.04 LTS
  2. Resize the main disk down to allow for a larger swap partition than the default 512MB. For example, for the $10 Linode 1024, resize the main partition to 22528MB, then resize the swap partition to 2048MB.
  3. Boot
  4. SSH into the VPS and run the following commands while remaining root:
  5. sudo apt-get update
  6. apt-get install -y linux-image-virtual grub2 mc htop
  • Optional: run htop and confirm the swap is 2048MB
  1. Choose the main disk for Grub to boot from, if asked
  2. mcedit /etc/default/grub and match the config to these settings:
    GRUB_CMDLINE_LINUX="console=ttyS0,19200n8"
    GRUB_DISABLE_LINUX_UUID=true
    [?: GRUB_SERIAL_COMMAND="serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1" was present in the guide, but I didn’t find it to be necessary]
  3. Save and run update-grub
  4. In your Linode’s Dashboard, Click on Edit under the Configuration Profiles section.
  5. In the Boot Settings section, select GRUB 2 from the Kernel drop down menu
  6. Save changes and reboot.
  7. SSH in again and run these commands (credit Peter Parente):
    apt-get -y install linux-image-extra-$(uname -r)
    sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
    sh -c "echo deb http://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list"
    apt-get update
    apt-get -y install lxc-docker
  8. Confirm that you have AUFS support by running docker info. You should not see devicemapper.
  9. Continue with the Discourse installation guide, starting with “Install Discourse” (since you have already installed Docker).

Disclaimer: I don’t exactly understand everything that’s going on here, but I’ve just performed these steps, and they’ve worked for me. Here’s Docker using AUFS:

root@localhost:/var/discourse# docker info
Containers: 0
Images: 7
Server Version: 1.9.1
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 7
 Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.13.0-77-generic
Operating System: Ubuntu 14.04.1 LTS
CPUs: 1
Total Memory: 993.9 MiB
Name: localhost

Note that this method of installing Docker might not add it to the startup script. I found that was fixed by launching the app and rebooting the Linode later.

17 Likes

Hi @dandv ,

I just looked at my disk usage on my Linode-based discourse node and found that the devicemapper sparse data file was using almost my whole disk space allocation. So I am about to embark on the process I gather that you already did: moving my Discourse forum from one Ubuntu 14.04 Linode to another with aufs enabled.

I’ll use the steps you kindly contributed above to provision the new linode. Based on what you wrote in the restoring backups thread, I assume that I should also copy over my app.yml file to the new docker install.

Can you say if there is anything else that you needed to do to completely and seamlessly move your forum from the devicemapper host to the aufs host?

TIA

It’s been a while but I think that was it. Give it a try and if you run into issues, I’m sure the community will help.

3 Likes

As a happy Linode customer, I asked about their support team about the steps here. The response was positive and I feel belongs here:

Thanks for writing us. The pre-packaged kernels we provide do not support AUFS, which is a docker requirement. The guide that you’ve linked to walks you through installing a distribution-supplied kernel for your Linode, which is very much a valid operation on our platform. Running your own kernel will allow you the flexibility to use modules not present in ours.

We have also have a guide for installing a distribution-supplied kernel here (this guide does not proceed with instructions specific to running Docker):

https://www.linode.com/docs/tools-reference/custom-kernels-distros/run-a-distribution-supplied-kernel-with-kvm

I can’t comment on why Docker would require a larger swap file, but everything else in the steps you’ve found make sense to me. If we can answer any other followup questions, we’d be happy to do so.

2 Likes