docker.io versus docker-ce

Wondering why you have a strange error such as ‘from …’ when running docker build. The reason is linked to an older version of docker installed.

Remove the current docker.io

You need to remove the current docker.io.

sudo apt-cache policy docker.io
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-cache policy docker-ce
sudo apt-get remove docker docker-engine docker.io
sudo apt-get install docker-ce

Forced to run “sudo docker” instead of docker

Run the following command:

sudo usermod -a -G docker <yourusername>

If you still have issue running docker instead of sudo docker, try to reboot. Worked for me.