Install Docker In Elementry Os
A Docker is designed to make developers life easier. Container based design helps developers to build, run and deploy applications in easier way with no dependencies.Dockerhelps to manage application and its dependencies in easy manner. we follow different steps to install docker on debian based linux distributions.
- Update package index
- Check debian flavour
- Install transport https
- Add Docker gpg Key
- Setting up stable repository
- Install Docker
- Check Docker version
So first of all we will update package index for fetching latest update from sources for that we will use this command.
[email protected]:~$ sudo apt-get update
Now in second step we will check that which dists of ubuntu we are using to check that, list the contents of sources.list file using command cat /etc/apt/sources.list. Here is my sources.list file contents, i am using elementry os hera.
# deb cdrom:[elementary OS 5.1 _hera_ - stable amd64 (20200204)]/ bionic contrib main non-free # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://in.archive.ubuntu.com/ubuntu/ bionic main restricted # deb-src http://in.archive.ubuntu.com/ubuntu/ bionic main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://in.archive.ubuntu.com/ubuntu/ bionic-updates main restricted # deb-src http://in.archive.ubuntu.com/ubuntu/ bionic-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://in.archive.ubuntu.com/ubuntu/ bionic universe # deb-src http://in.archive.ubuntu.com/ubuntu/ bionic universe deb http://in.archive.ubuntu.com/ubuntu/ bionic-updates universe # deb-src http://in.archive.ubuntu.com/ubuntu/ bionic-updates universe
as you can see i have marked my ubuntu dists verion in bold so i am using bionicubuntu version.
Now install some important packages like curl, transport-https, software-properties-common, gnupg on your system using the following command.
[email protected]:~$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common
Now run this command on your system to add docker official gpg keys.
[email protected]:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Now we will setup a stable repository in apt directory using following command, and update the source package list.
[email protected]:~$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ bionic \ stable" [email protected]:~$ sudo apt-get update
In above command you should notice i have used bionic because in sources.list file i am using ubuntu bionic official package for elemetary os hera.
In this step we will install docker and docker-compose. To install docker and docker-compose use the following command.
[email protected]:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose
After sucessfull installation check installed version of docker and docker-compose using following commands.
[email protected]:~$ docker -v Docker version 19.03.6, build 369ce74a3c [email protected]:~$ docker-compose -v docker-compose version 1.17.1, build unknown
As you can see output of above command shows docker version and build hash. For any queries or doubts feel free to reach out through comment.