How To Install Docker On Ubuntu 18.04
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的更多相关文章
- Install Openjdk11 to Ubuntu 18.04 LTS
Ubuntu 18.04 LTS系统上通过sudo apt install openjdk-11-*命令安装的jdk11版本依然是jdk10,怎么样才能安装openjdk 11呢,今天,我们就来完 ...
- How to install tensorflow on ubuntu 18.04 64bit
Ans:pip install tensorflow (note: version number of pip and python must be consistent)
- 如何在Ubuntu 18.04上安装Go
如何在Ubuntu 18.04上安装Go 谢鸢发表于云计算教程系列订阅98 介绍 课程准备 第1步 - 安装Go 第2步 - 设置Go路径 第3步 - 测试您的安装 结论 介绍 Go是Google开发 ...
- [笔记] Ubuntu 18.04安装Docker CE及nvidia-docker2流程
Docker的好处之一,就是在Container里面可以随意瞎搞,不用担心弄崩Host的环境. 而nvidia-docker2的好处是NVidia帮你配好了Host和Container之间的CUDA相 ...
- [笔记] Ubuntu 18.04安装Docker CE及NVIDIA Container Toolkit流程
之前写的[笔记] Ubuntu 18.04安装Docker CE及nvidia-docker2流程已经out了,以这篇为准. Docker的好处之一,就是在Container里面可以随意瞎搞,不用担心 ...
- Ubuntu 18.04下Couldn't connect to Docker daemon at http+docker://localunixsocket解决办法
一台服务器系统为:Ubuntu 18.04 LTS,上面建了git裸仓库,用于开发吧代码push到这里.同时WEB测试环境通过docker也部署在这台.通过git钩子post-receive,当有新代 ...
- 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 ...
- 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 ...
- 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 -- ...
随机推荐
- PAT(B) 1068 万绿丛中一点红(C)
题目链接:1068 万绿丛中一点红 (20 point(s)) 参考博客:1068. 万绿丛中一点红(20) i逆天耗子丶 题目描述 对于计算机而言,颜色不过是像素点对应的一个 24 位的数值.现给定 ...
- FPS 游戏实现D3D透视
FPS游戏可以说一直都比较热门,典型的代表有反恐精英,穿越火线,绝地求生等,基本上只要是FPS游戏都会有透视挂的存在,而透视挂还分为很多种类型,常见的有D3D透视,方框透视,还有一些比较高端的显卡透视 ...
- vue-cli3+mand-mobile svg 配置
// vue.config.js chainWebpack: config => { config.resolve.alias // key,value自行定义,比如.set('@assets' ...
- 编写一个stm32 svc关中断函数
做到了让stm32触发svc中断并传递进去参数然后切换到handler模式并修改特殊寄存器的值,从而达到关中断,但是其实这个程序直接就是特权级,故不进入handler模式也可以修改特殊寄存器..... ...
- 在浏览器中输入www.taobao.com后执行的全部过程
>>>点击网址后,应用层的DNS协议会将网址解析为IP地址: DNS查找过程: 1. 浏览器会检查缓存中有没有这个域名对应的解析过的IP地址,如果缓存中有,这个解析过程 ...
- awk 概述及常用方法总结
awk 简介 awk是一个文本处理工具,通常用于处理数据并生成结果报告, awk的命名是它的创始人 Alfred Aho.Peter Weinberger和Brian Kernighan 姓氏的首个字 ...
- redis连接数高居不下,怎么破?。。。。这么破
最近项目一直在使用redis,首次用redis,随便从网上找了例子就用了,一开始用的还挺正常,后来发现,当客户端访问量一上来,redis的连接数居高不下,一开始以为是客户端没有关闭,开始怀疑redis ...
- 微信H5支付(基于Java实现微信H5支付)
微信的H5支付区别与APP支付,主要在于预下单(返回的参数不一样),其它大体相同(基本没什么区别,区别在于有些人加密喜欢用MD5有些人喜欢用官方提供的加密方式加密,我用的是官方的),贴一下H5支付预下 ...
- Python标准库3.4.3-urllib.request-21.6
21.6. urllib.request — Extensible library for opening URLs 翻译:Z.F. The urllib.request module defines ...
- C++——异常处理
前言 大型和十分复杂的程序往往会产生一些很难查找的甚至是无法避免的运行时错误.当发生运行时错误时,不能简单地结束程序运行,而是退回到任务的起点,指出错误,并由用户决定下一步工作.面向对象的异常处理(e ...