how to install docker with apt-get

Instead of using docker use docker.io
sudo apt-get install docker.io
http://stackoverflow.com/a/30379382?stw=2

Why install docker on ubuntu should be `sudo apt-get install docker.io`?
Ans =
Why do Ubuntu use docker.io as executable name instead of just docker? Tutorials, blog posts all now have to mention this difference, “if you use Ubuntu 14.04, or if you are with rest of the world (including earlier versions of Ubuntu)”. Why?

This is because of a Debian/Ubuntu policy; there is already a program called “docker” [1], and it was not allowed to use the same binary name.
http://stackoverflow.com/a/27978397