Unfortunately it is not a straight forward process for getting Docker installed on Linode using Ubuntu 16.04. The Image that Linode provides for Ubuntu 16.04 has a custom Linux Kernel installed in it. Docker requires AUFS, which is part of the linux-image-extra package. This package is tied to the kernel version, and since Linode kernel is custom, it is not clear how to load this package. In order to make this work, you have to revert your install back to the distribution kernel.
Here are the steps to get it working:
- Deploy a Ubuntu 16.04 image on Linode
- Follow these steps:
https://www.linode.com/docs/tools-reference/custom-kernels-distros/run-a-distribution-supplied-kernel-with-kvm - Then install the Docker-Engine:
https://docs.docker.com/engine/installation/linux/ubuntulinux/ - Finally, lock-down and set things up:
https://www.linode.com/docs/security/securing-your-server
Comments
6 responses to “Getting Docker up on Linode, with Ubuntu 16.04”
Very helpful, thanks for the tip! It’s really hard to find resources on running Docker on Linode.
Thanks a lot Luke for the helpful write-up. It was this short guide which let me succeed after all.
@Amin and others: Following my installation documentation, might be helpful for you to overcome problems:
* Configure GRUB2 and change kernel > Identify ‘current’ kernel version *
Apply uname -a
* Install Grub2 *
Apply apt-get install linux-image-virtual grub2
Choose to not install it to MBR / disk image. But since Linode provides the grub bootloader, the system need only provide the grub.cfg file
Verify kernel version /boot/vmlinuz-4.4.0-22-generic
* Configuring Grub *
Apply nano /etc/default/grub
Change / Add GRUB_TIMEOUT=10
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″
GRUB_TERMINAL=serial
Apply update-grub
* If you later install an updated kernel, you’ll need to run this command again to update your GRUB menu. By default, the first kernel in the list will be booted. *
* Rebooting into Grub2 Mode *
Edit Configuration Profiles section of Linode’s Dashboard
Select GRUB 2 (from the Kernel drop down menu in Boot Settings section)
* Identify ‘after’ kernel version *
Apply uname -a
Output Linux greenfree 4.4.0-22-generic #40-Ubuntu SMP
* Prepare for Docker installation > Update apt sources *
Apply apt-get update
apt-get install apt-transport-https ca-certificates
* Add the new GPG key *
Apply apt-key adv –keyserver hkp://p80.pool.sks-keyservers.net:80 –recv-keys [YourKeyID]
* Update /etc/apt/sources.list.d/docker.list file (if not existent create it) *
Open Nano nano /etc/apt/sources.list.d/docker.list
Remove All previous entries
Add deb https://apt.dockerproject.org/repo ubuntu-xenial main (my Ubuntu OS)
* Update apt package index *
Apply apt-get update
Purge the old repo apt-get purge lxc-docker (if it exists)
* Verify that apt is pulling from the right repository *
Apply apt-cache policy docker-engine
* Install linux-image-extra kernel package (allows use of AUFS storage driver) *
Apply apt-get update (Update package manager)
Apply apt-get install linux-image-extra-$(uname -r)
* Install Docker *
Update apt package index
Apply apt-get update
Apply apt-get install docker-engine
* Start docker daemon *
Apply service docker start
* Verify docker is installed correctly *
Apply docker run hello-world ”
Happy to exchange experiences, email me at hello[at]eco-git.org
Thanks so much for putting this together. I’ve spent the last day banging my head against the wall.
Another solution is to use OverlayFS instead of AUFS. This will be the default behavior in Docker 1.13. It’s included in the Linode 4.8+ kernels so you don’t need to install an distro kernel or grub for this solution to work!
1. Set up device-mapper so the Docker install doesn’t hang:
sudo apt-get install dmsetup
sudo dmsetup mknodes
2. Install Docker:
sudo apt-get install docker-engine
3. Modify the service unit file for Docker to pass the storage driver argument to dockerd:
sudo mkdir /etc/systemd/system/docker.service.d
sudo tee -a /etc/systemd/system/docker.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -s overlay
EOF
4. Reload systemd so it sees the new override.conf, and restart the daemon:
sudo systemctl daemon-reload
sudo systemctl restart docker
Hope this helps!
Sorry, I meant to add that this solution is tested for Docker 1.12.5 installed from apt.dockerproject.org, and for more information:
http://blog.thestateofme.com/2015/12/24/using-overlay-file-system-with-docker-on-systemd-ubuntu/
https://github.com/docker/docker/issues/23347
https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/
Just tried the alternative solution proposed above by Mike Pastore. Works perfectly, thanks!