[SOLVED] How to Install Docker in Ubuntu?
Docker is an open-source platform for system administrators and developers to build, ship, and run distributed applications, whether it's on the cloud, data center VMs, or laptops. Docker helps to automate the deployment of Linux applications inside software containers.
This write-up helps you to learn, install, upgrade, and un-installation of Docker engine.
Docker is supported on the following Ubuntu operating systems:
- Ubuntu Precise 12.04 (LTS)
- Ubuntu Trusty 14.04 (LTS)
- Ubuntu Wily 15.10
- Ubuntu Xenial 16.04 (LTS)
Note: Ubuntu Utopic 15.04 and Ubuntu Utopic 14.10 exists in Docker’s APT repository, but they are no longer officially supported.
Regardless of the Ubuntu version, Docker requires a 64-bit installation. Additionally, the Ubuntu kernel must be minimum at 3.10. Kernels older than 3.10 will lack some features to run the docker containers. That is, A newer maintained version or the latest minor version 3.10 version are acceptable. Older versions also have some known bugs, that can cause data loss and frequently panic in some cases.
You can check your kernel version by typing the following command in the Ubuntu terminal.
$ uname -r
You will be displayed a kernel version as below.
After confirming the Operating system requirements, you can update your package manager by running the following command in the Ubuntu terminal.
$ sudo apt-get update
As the Ubuntu package manager has been updated, You can now install
docker-engine by running the following command in your Ubuntu terminal.
$ sudo apt-get install docker-engine
After the installation you can start the Docker service, by running the following command in your Ubuntu terminal.
$ sudo service docker start
Now, you can verify docker is installed correctly.
$ sudo docker run hello-world
The above command downloads a test docker image and runs it in a container, which prints an informational message.
To install the latest version of Docker, run the following command in your Ubuntu terminal.
$ sudo apt-get upgrade docker-engine
To uninstall a docker package run the following command in your Ubuntu terminal.
$ sudo apt-get purge docker-engine
As the dependencies were no longer needed
$ sudo apt-get autoremove --purge docker-engine
As the above commands, will not remove the containers, volumes, images, or configuration files in your host, you can run the following command to delete the containers, volumes, images, or configuration files, by running the following command in your terminal. You must remove the user configuration files manually.
$ rm -rf /var/lib/docker
Hope this helps!