Introduction to Docker
Docker is an open-source project, designed to benefits both developers and operators by providing platform as a service that uses OS-level virtualization to deliver software in packages. Docker has made it easier for them to pack, ship, and run any application as a lightweight, portable, self-sufficient containers. These containers are isolated from one another and bundle their own libraries, dependencies and configuration file. This makes it easier to modify and update the program.
In a way, Docker is a bit like a virtual machine. Originally built for Linux, Docker now runs on Windows and MacOS as well and allows applications to use the same kernel as the system that they’re running on and only requires applications be shipped with things not already running on the host computer rather than creating a whole virtual operating system. This means they are much more efficient than hypervisors in system resource terms.
With that being said, let’s take a look on how to install docker on your machine
To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:
- Ubuntu Focal 20.04 (LTS)
- Ubuntu Bionic 18.04 (LTS)
- Ubuntu Xenial 16.04 (LTS)
STEP 1: UPDATE THE PACKAGES
STEP 2: SET UP THE REPOSITORY
Add the Docker repository to APT source
STEP 3: INSTALL DOCKER ENGINE
- Update the apt package index, and install the latest version of Docker Engine and container, or go to the next step to install a specific version:
To list different version of docker use command:
At this point, type the command: sudo apt-get install docker-ce=[version]
2. Verify that Docker Engine is installed correctly by running the hello-world image.
OOPS!! That’s not the output we were looking for.
By default, running Docker commands requires administrator privileges.
To run Docker commands as a non-root user without prepending sudo you need to add your user to the docker group. This group is created during the installation of the Docker CE package. To do that run the following command: newgrp docker
And then run the hello-world image.
Congratulations!! You have learned how to install Docker on your Ubuntu machine.