Install Docker PPA on Ubuntu 16.04 With Good Defaults


Sometimes you may not want to install Docker with the wonderfully useful curl -sSL https://get.docker.com/ | sh, so here's a few options for being more literal with your engine install, which I've got in a gist, also seen below. One is just for copy-pasting into shell of server, and other is for creating shell scripts good for automation.

Updated May 2017 for docker's new release versioning and recommended install process

Things it does above and beyond:

  • Uninstalls LXC, which comes default in Ubuntu 16.04 and you don't need if you're using Docker. Packages removed include lxc-common lxcfs lxd lxd-client
  • Enables User Namespaces. IMO it's a great feature to turn on in most cases so your containers don't run as root on the host. This is the "userns-remap" : "default" part. More info on the internals in a Docker KB, but usually it just works.
  • Changes to overlay2 storage driver (not yet the default), so if you want something else then you'll want to change this up a bit. This is enabled by simply adding "storage-driver" : "overlay2". Note it requires the newer 4.x kernel of Ubuntu 16.04.