Introduction
When you install docker form ubuntu source, you may cannot install the lasted version. It may lead to you cannot implement your environment or have a error when you running your project.
This article will show you how to uninstall and install the lasted version docker on Ubuntu Linux 16.04.2.
For more information, please read the offical website.
Uninstall old versions
Before install the lasted version, let’s uninstall the old version.
Running command:
sudo su apt-get remove docker docker-engine docker.io
Install Repository
After uninstall old version, now let’s install repository. First, we update our APT. Please make sure all following command is running on the root user. If you get message that tell you “Permission denied“. This means that you do not user root user to run the command or do not switch to root user. When you receive this error message, you can run command: sudo su to switch to root user. (This command may ask you to input your password)
sudo apt-get update
Then, we install following packages.
apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common
Then, we add GPG Key.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
After install the key, we verify the fingerprint, make sure that it is correct. The correct fingerprint should be:
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
sudo apt-key fingerprint 0EBFCD88
Install Docker
Now, let’s install the lasted version (stable version).
First, we add the repository. After adding the repository, we update our APT.
sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" apt-get update
Finally, we install it via apt-get.
sudo apt-get install docker-ce
Testing
Now, let’s testing that it is working or not by using following command:
docker run hello-world
If we install correctly, it will show the hello message, and then print information, and finally, exit.
Summary
Now, we finish the installation. You can run your project on your Ubuntu Linux. Recently, I will try to build a vulnerability environment based on it. And hopefully, I can finish it on next week. If you have any question, please let me know. I will answer you ASAP.