Linux Commands and Scripts

Steps to Install Docker on Ubuntu 18.04

In this article, we will learn how it is easy to install Docker on Ubuntu 18.04.

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.

Docker is a remarkably popular containerization tool, which is fairly easy to use. It makes it easy to duplicate applications across multiple servers and to build different server environments for a single server application.

Docker is a software tool which enables you to create and deploy standalone containers which contain a specific element of a software project. For example, you may deploy an apache container, a MySQL container, and a PureFTP container in order to create a simple web server. Each Docker container receives its own CPU, memory, block I/O, and network resources in order to segment the server between applications.

Prerequisites:

  • Dedicated server or VPS with Ubuntu OS installed
  • 512MB RAM (2GB Recommended)
  • Disk space is depend on your project requirements.
  • CPU is also depend on the application you will run on the docker.

Easy to Install Docker on Ubuntu

1. Keep server updated

Always keep your server up-to-date for security purpose.

# apt-get update -y

2. Install dependencies

Install the required dependencies for Docker:

# apt-get install apt-transport-https a-certificates curl gnupg-agent software-properties-common -y

3. Add the Docker CPG Key

# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

4. Add the Docker Repository

# add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”

5. Install Docker Engine

The following command will download Docker and install it:

# apt-get update -y

# apt-get install docker-ce docker-ce-cli containerd.io -y

6. Verify Setup

# docker run hello-world

The following screen will appear upon a successful installation of Docker:

Status: Downloaded newer image for hello-world: latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the “hello-world” image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
root@ubuntu: ~#

That’s it. The docker is installed now. You can deploy Docker containers.

In this article, we have learnt how it is easy to install Docker on Ubuntu 18.04.

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles