How to Install Docker on Ubuntu Server?

According to the official website of Docker, “Docker is the world’s leading software containerization platform.” Docker runs your app in an isolated environment. But Docker is not a virtualization technology. Docker uses the containerization technique built into the Linux kernel itself.

For example, let’s say you want to run an isolated Apache HTTP server and let it access the specified files and directories of your local system. You can easily do that with Docker.

So when there a new software version available, you just update that piece of software (update container) and you’re good to go. You won’t have to worry about breaking your computers OS. Isn’t that a great advantage? In this article, I am going to show you how to install Docker on the Ubuntu server.

To follow this tutorial, you need,

  • A computer or virtual machine with Ubuntu Server installed.
  • Basic understanding of Linux command line.
  • Internet connection for downloading the required packages.





First, we need to install the Linux kernel extras. To do that, run the following commands.

$ sudo apt-get update
$ sudo apt-get install curl linux-image-extra-$(uname -r) linux-image-extra-virtual

Now we have to add the Docker repository. Docker repository delivers the files over HTTPS. apt package manager might know how to use the HTTPS protocol in your system. So to make sure it does download packages via HTTPS first. To do that, run the following command to download the required packages.

$ sudo apt-get install apt-transport-https ca-certificates

Before adding the repository, we have to add the GPG key of the repository. To do that, run the following command.

$ curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add -

How to Install Docker on Ubuntu Server

Now we can add the Docker repository. Run the following command to add it.

$ sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ ubuntu-$(lsb_release -cs) main"

Now, you can install docker. To install docker, run the following command.



$ sudo apt-get update
$ sudo apt-get -y install docker-engine

How to Install Docker on Ubuntu Server

Docker is installed. Now let’s run a simple docker program and test it.

$ sudo docker run hello-world

How to Install Docker on Ubuntu Server

The hello-world program should run.

That’s how you install Docker on Ubuntu Server. To learn more about Docker, go to the official website of Docker and to learn about Ubuntu, you can visit this link of Tutorialology for Ubuntu tutorials.