Docker is an increasingly popular software package that creates a container for application development.

Developing in Docker speeds up applications, as it shares the kernel and other resources, instead of requiring dedicated resources.

There are two versions of Docker – Docker CE (Community Edition) and Docker EE (Enterprise Edition). If you have a small-scale project, or you’re just learning, you’ll want to use Docker CE.

In this tutorial, we will cover how to install Docker on Ubuntu 18.04.

Prerequisites

 
  • Ubuntu 18.04 64-bit operating system
  • A user account with sudo privileges
  • Command line / terminal (CTRL-ALT-T or Applications menu > Accessories > Terminal)
  • Docker software repositories (optional)

Install Docker on Ubuntu Using Default Repositories

 

Step 1: Update Software Repositories

 

As usual, it’s a good idea to update the local database of software to make sure you’ve got access to the latest revisions.

Therefore, open a terminal window and type:

sudo apt-get update

Allow the operation to complete.

Step 2: Uninstall Old Versions of Docker

 

Next, it’s recommended to uninstall any old Docker software before proceeding.

Use the command:

sudo apt-get remove docker docker-engine docker.io

Step 3: Install Docker

 

To install Docker on Ubuntu, in the terminal window enter the command:

sudo apt install docker.io

Step 4: Start and Automate Docker

 

The Docker service needs to be setup to run at startup. To do so, type in each command followed by enter:

sudo systemctl start docker
sudo systemctl enable docker

Step 5 (Optional): Check Docker Version

 

To verify the installed Docker version number, enter:

docker --version


 

Note: The official Docker website does not offer support for Ubuntu 18.04. It’s possible that the Ubuntu default repositories have not updated to the latest revision. There’s nothing wrong with running this installation. However, if you are up for a slightly more intensive operation, you can install a more recent (or specific) Docker from the official Docker repositories.


 

Alternative: Install Docker from Official Repository

 

Step 1: Update Local Database

 

Update the local database with the command:

sudo apt-get update

Step 2: Download Dependencies

 

You’ll need to run these commands to allow your operating system to access the Docker repositories over HTTPS.

In the terminal window, type:

sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

To clarify, here’s a brief breakdown of each command:

  • apt-transport-https: Allows the package manager to transfer files and data over https
  • ca-certificates: Allows the system (and web browser) to check security certificates
  • curl: This is a tool for transferring data
  • software-properties-common: Adds scripts for managing software

Step 3: Add Docker’s GPG Key

 

The GPG key is a security feature.

To ensure that the software you’re installing is authentic enter:

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

Step 4: Install the Docker Repository

 

To install the Docker repository, enter the command:

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

The command “$(lsb_release –cs)” scans and returns the codename of your Ubuntu installation – in this case, Bionic. Also, the final word of the command – stable– is the type of Docker release.

A stable release is tested and confirmed to work, but updates are released less frequently. You may substitute edge if you’d like more frequent updates, at the cost of potential instability. There are other repositories, but they are riskier – more info can be found on the Docker web page.

Step 5: Update Repositories

 

Update the repositories you just added:

sudo apt-get update

Step 6: Install Latest Version of Docker

 

To install the latest version of docker:

sudo apt-get install docker-ce

Step 7 (Optional): Install Specific Version of Docker

 

List the available versions of Docker by entering the following in a terminal window:

apt-cache madison docker-ce


The system should return a list of available versions as in the image above.

At this point, type the command:

sudo apt-get install docker-ce=<VERSION>

However, substitute <VERSION> for the version you want to install (pulled from the list you just generated).

For example:

Step 8 (Optional): Install from a .deb Package

 

First, open a web browser, and go to the following web address:

https://download.docker.com/linux/ubuntu/dists/bionic/

Next, click on the pool link, then stable, then amd64.  This is the location of the stable Docker releases for Ubuntu 18.04.

At the time this article was written, this directory was empty. This indicates that there are no verified stable releases for Ubuntu 18.04.

Not to worry, though! The previous versions should work just fine. Alternatively, you can install an edge release by browsing to:

https://download.docker.com/linux/ubuntu/dists/bionic/pool/edge/amd64/

Download the file, and make a note of the path where you saved it. Use the following command:

sudo dpkg -i /path/to/package.deb

Substitute your file location for /path/to/package.deb. Allow the installer to run.

Conclusion

 

Great job!  You’ve got three (3) different options for installing Docker on Ubuntu 18.04.

Finally, you can check the Docker guides if you get into trouble, plus they have a fairly robust forum you can search. Happy developing!

 
 

Author


 
 
 

Sofija Simic

Sofija Simic is an aspiring Technical Writer at phoenixNAP. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations.

 

How To Install Docker On Ubuntu 18.04的更多相关文章

  1. Install Openjdk11 to Ubuntu 18.04 LTS

      Ubuntu 18.04 LTS系统上通过sudo apt install openjdk-11-*命令安装的jdk11版本依然是jdk10,怎么样才能安装openjdk 11呢,今天,我们就来完 ...

  2. How to install tensorflow on ubuntu 18.04 64bit

    Ans:pip install tensorflow (note:  version number of pip and python must be  consistent)

  3. 如何在Ubuntu 18.04上安装Go

    如何在Ubuntu 18.04上安装Go 谢鸢发表于云计算教程系列订阅98 介绍 课程准备 第1步 - 安装Go 第2步 - 设置Go路径 第3步 - 测试您的安装 结论 介绍 Go是Google开发 ...

  4. [笔记] Ubuntu 18.04安装Docker CE及nvidia-docker2流程

    Docker的好处之一,就是在Container里面可以随意瞎搞,不用担心弄崩Host的环境. 而nvidia-docker2的好处是NVidia帮你配好了Host和Container之间的CUDA相 ...

  5. [笔记] Ubuntu 18.04安装Docker CE及NVIDIA Container Toolkit流程

    之前写的[笔记] Ubuntu 18.04安装Docker CE及nvidia-docker2流程已经out了,以这篇为准. Docker的好处之一,就是在Container里面可以随意瞎搞,不用担心 ...

  6. Ubuntu 18.04下Couldn't connect to Docker daemon at http+docker://localunixsocket解决办法

    一台服务器系统为:Ubuntu 18.04 LTS,上面建了git裸仓库,用于开发吧代码push到这里.同时WEB测试环境通过docker也部署在这台.通过git钩子post-receive,当有新代 ...

  7. How to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux

    Objective The objective is to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux. This a ...

  8. How to Install Oracle Java 11 on Ubuntu 18.04 LTS (Bionic) Written by Rahul, Updated on April 3, 20

    本文系转载备份 请阅读点击下面链接阅读原文以获取更佳地阅读体验.谢谢. How to Install Oracle Java 11 on Ubuntu 18.04 LTS (Bionic) Writt ...

  9. Caffe Install by Cmake in Ubuntu 18.04

    环境: Ubuntu 18.04 CUDA 10.0 cudnn opencv 3.0 见 https://www.cnblogs.com/xiaoniu-666/p/11907710.html -- ...

随机推荐

  1. django使用pyecharts(1)----django加入echarts

    Django 中使用 pyecharts.一.普通django加入echarts Django 模板渲染 Step 0: 新建一个 Django 项目 $ django-admin startproj ...

  2. 20191104-基于Python计数排序算法分析

    计数排序 计数排序算法没有用到元素间的比较,它利用元素的实际值来确定它们在输出数组中的位置,也就是说元素从未排序状态变为已排序状态的过程,是由额外空间的辅助和元素本身的值决定的,将每个元素出现的次数记 ...

  3. docker 实践十一:docker 跨主机通讯

    在上一篇了解了关于 docker 的网络模型后,本篇就基于上一篇的基础来实现 docker 的跨主机通信. 注:环境为 CentOS7,docker 19.03. 本篇会尝试使用几种不同的方式来实现跨 ...

  4. python检测当前网卡流量信息,用于查看实时网速

    可以用来检测是否有挖矿程序在运行的一个子条件 # coding:utf-8 __author__ = 'chenhuachao' import wmi import time import platf ...

  5. vs setup 自动下载依赖的framework配置

    1.项目->属性->签名->选中为ClickOnce清单签名->创建测试证书 2.项目->属性->安全性->启用ClickOnce安全设置 3.setup项目 ...

  6. flutter从入门到精通三

    flutter可以通过一套代码运行在多个平台上,包括移动,web,桌面,嵌入式,但是在 Web 平台的支持尚未达到 Beta 阶段,请不要用在生产环节,在阅读文档时候,推荐大家阅读https://fl ...

  7. Windows Mobile设备中心不能正常运行

    1.开始-->运行,输入services.msc回车 2.在打开的服务界面中,找到“基于Windows Mobile 2003的连接设备” 3.打开的属性 ,找到登录项,登录身份选择“本地系统账 ...

  8. springboot_1

    1. 创建一个spring boot项目可以使用哪些工具 1.1 使用start.spring.io 这是一个网站,可以在这个网站选择你需要的组件,然后会自动生成一个项目文件,你可以将它下载到本地,然 ...

  9. 调试location指令时,直接让location输出文本

    有时候我们调试location指令时希望location指令能够直接输出文本,这样能够方便我们进行调试.这时我们可以使用echo模块实现,但是大多数情况我们没有安装这个模块,那么我们还可以使用另一个方 ...

  10. Cookie实现记住密码的功能

    一.什么是Cookie cookie是一种WEB服务器通过浏览器在访问者的硬盘上存储信息的手段.Cookie的目的就是为用户带来方便,为网站带来增值.虽然有着许多误传,事实上Cookie并不会造成严重 ...