How to Install and Use Docker in Ubuntu 18:04 – Docker is containerisasi technology that allows you to quickly build, test, and use the app as a portable and self-contained container that can run almost anywhere. Docker has become the de facto standard for the deployment of the container, and this is an important tool for engineers DevOps and continuous integration and delivery lines. This service has free and premium tiers. The software accommodates this container is called Docker Engine.

Docker is a set of platform as a service (PaaS) products using OS-level virtualization software to send in a package called container. Container isolated from each other and combine their own software, libraries and configuration files; they can communicate with each other through a clear channel. All containers are run by a single operating system kernel and therefore lighter than the virtual machine.

Docker install ubuntu way

In this tutorial, I will discuss how to install Ubuntu 18:04 Docker on the computer and explore the concepts and basic commands Docker.

Read: How To Install Eclipse IDE on Linux Ubuntu 18:04

Requirements for Install and Use Docker in Ubuntu

Before proceeding with the tutorial how to install ubuntu docker at this, make sure you sign in as a user with privileges sudo. All commands in this tutorial should be run as a non-root user.

Read: How to Create a User Sudo and Sudo Group in Ubuntu

How to Install Ubuntu Docker

Although Docker installation package is available in the official repositories of Ubuntu 18:04, but may not be the latest version. It is recommended to install the latest packages from the repository Docker Docker.

Enabling Repository Docker

Start by updating the list of packages and install the dependencies needed to add a new repository via HTTPS:

$ sudo apt update
$ sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

Import GPG key repository using the command curlbelow:

$ curl -fsSL | sudo apt-key add -

Add APT Repository Docker to your system:

$ sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

Installing Docker CE

Docker Now that the repository is enabled, you can install a version of Docker you need.

Docker to install the latest version, use the command below. If you want to install certain Docker version, skip this step and go to the next one.

$ sudo apt update
$ sudo apt install docker-ce

To install a specific version, the first list of versions available in the repository Docker:

$ apt list -a docker-ce

This command Docker print version available in the second column.

docker-ce/bionic 5:18.09.7~3-0~ubuntu-bionic amd64
docker-ce/bionic 5:18.09.6~3-0~ubuntu-bionic amd64
docker-ce/bionic 5:18.09.5~3-0~ubuntu-bionic amd64

For example, to install a version 18.09.6 you type:

$ sudo apt install docker-ce=5:18.09.6~3-0~ubuntu-bionic

In order Docker package are not updated automatically, mark it hold:

$ sudo apt-mark hold docker-ce

After installation is complete, the service will start automatically Docker. You can verify this by typing:

$ sudo systemctl status docker

The output will look something like this:

docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor p
   Active: active (running) since Tue 2019-07-02 11:28:40 UTC; 15min ago
 Main PID: 11911 (dockerd)
    Tasks: 10
   CGroup: /system.slice/docker.service

Without Sudo command run Docker

By default manage Docker require administrator rights.

Docker to execute commands as non-root users without adding sudoyou must add your users to the group docker. This group is created during package installation Docker CE. To do that run the following command:

$ sudo usermod -aG docker $USER

$USER is an environment variable that holds your username.

Log out and log back in to refresh the group membership.

To verify that the Docker has been successfully installed and you can run sudo commands without adding docker, run:

$ docker container run hello-world

The command will download the test image, run it in a container, print the message “Hello from Docker” and exit. The output will look something like the following:

docker hello world tutorial

How to Upgrade Docker

When Docker new version is released, you can update packages using standard improvement process:

$ sudo apt update
$ sudo apt upgrade

How To Uninstall Docker

Before deleting Docker, remove all the containers, images, volume, and network.

You can uninstall Docker as other packages that are installed with apt:

$ sudo apt purge docker-ce
$ sudo apt autoremove

Command Line Interface Docker

Docker CLI command takes this form:

$ docker [option] [subcommand] [arguments]

To see a list of all available commands type dockerwithout parameters:

$ docker

If you need further assistance on [subcommand]anything, you can use the --helpswitch as shown below:

$ docker [subcommand] --help

Docker Image

Docker Image consists of a series of layers that represent the file system of instruction in Dockerfile images that make software applications that can be executed. An image is a binary file that can not be changed, including the application and all other dependencies such as libraries, binaries, and instructions necessary to run the application.

You can think of an image as a snapshot Docker Docker container.

Most images are available at Docker Docker Hub. Docker Hub is a cloud-based service registry among other functions used for storing images Docker in public or private repositories.

Read: Guide How to Install Ruby on Ubuntu 18:04

Search Docker Image

To search for images of the registry Docker Hub, use the command search.

For example, to search for images of Ubuntu, you must type:

$ docker search ubuntu

The output will look something like this:

docker search image tutorial

As you can see, the search print a table with five columns, consisting of: NAME, DESCRIPTION, STARS, and AUTOMATED OFFICIAL.

Official image is an image that was developed together with partner Docker upstream.

Most images Docker Docker in the Hub marked with a version number. When no tag is specified, Docker will pull the latest.

Download Docker Image

For example, to download the latest official build of Image Ubuntu 18:04, you will use the withdrawal command shown below:

$ docker image pull ubuntu

docker pull image tutorial

Depending on your Internet speed, the download process may take a few seconds or minutes.

When not specify a tag, Docker latest Ubuntu interesting pictures, which at the time of writing this article is 18.04.

If you want to download the previous Ubuntu release, say Ubuntu 16:04 then you need to use the image Docker pull ubuntu: 16:04.

To include a list of all types of images that are downloaded, use the command:

$ docker image ls

The output will look something like this:

install docker ubuntu list images

How to Remove Docker Image

If for some reason, you want to delete an image, you can do with a sub-command image rm [image_name]:

$ docker image rm ubuntu

Docker Containers

An instance of an image called a container. Container represents a runtime for an application, process, or service.

This may not be the most appropriate comparison, but if you are a programmer, you can assume Docker Docker Image as a class and as a derivative of the Class Container.

We can start, stop, remove, and manage a container with a sub-command docker container.

Start Docker Container

The following command will start a Docker container based on Ubuntu image. If you do not have the image locally, it will download it first:

$ docker container run ubuntu

At first sight, it seems that nothing happened at all. But that is not true. Ubuntu container stopped immediately after booting because it does not have a long-running process, and I do not give any commands. Container boot, execute the command is empty, and then exit.

Command -itallows us to interact with the container via the command line. To start this type of interactive container:

$ docker container run -it ubuntu /bin/bash



As you can see from the above output, after the container is started, the command prompt changes. This means that you are now working from inside the container.

List Docker Container

To see a list of active container, type:

$ docker container ls

install docker ubuntu list containers

If you do not have a container that is being run, the result will be empty.

To view the active container and inactive, given the switch -a:

$ docker container ls -a

Remove Docker Container

To delete one or more containers, copy the Container ID (or IDs) and the sub-command rekatkannya after container rm:

$ docker container rm c55680af670c


You have to learn how to install Ubuntu 18:04 Docker on your computer and how to download and manage Docker Docker Image Container. You may also want to read about Docker Compose, which allows you to define and execute a multi-Container Docker applications.

Tutorial how to install and use a docker in Ubuntu this is just a basic guide, to learn more about Docker, see the official Docker documentation here .