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!

Next, You Should Also Read:

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.

原文地址:https://www.cnblogs.com/mouseleo/p/11867793.html

时间: 2024-11-10 14:26:44

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呢,今天,我们就来完成这一工作. download software package [email protected]:~$sudo curl -sL https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz -

Install Docker in Ubuntu 16.04 LTS

add key sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D add sources sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main' update apt update install a

Ubuntu 18.04安装Docker CE + NVIDIA-Docker

容器将应用程序封装到隔离的虚拟环境中,以简化数据中心的部署.通过将所有应用程序依赖项 (例如二进制文件和库) 都包括在内,应用程序容器能在任何数据中心环境中无缝地运行. 英伟达基于Docker 提供的NVIDIA-Docker可用于容器化 GPU 加速的应用程序.这意味着无需进行任何修改即可轻松容器化和隔离加速的应用程序,并将其部署到任何受支持的.可使用 GPU 的基础架构上. 管理和监控加速的数据中心将变得空前容易. 一.安装Docker 在前面的博文中,我们已经介绍了在Ubuntu系统中安装

备忘 ubuntu 18.04 下安装 tensorflow GPU 版本

转自:https://www.cnblogs.com/hutao722/p/9342577.html tensorflow目前已经升级至r1.9版本.在之前的深度学习中,我是在MAC的虚拟机上跑CPU版本的tensorflow程序,当数据量变大后,tensorflow跑的非常慢,在内存不足情况下,又容易造成系统崩溃(虚拟机走的是windows7). 配置信息 为了后续的深度学习,不得已,我在京东买了一部组装厂商提供的主机,是网吧特供机.配置如下: CPU i5 8400 6核 16G内存 GPU

Ubuntu 18.04 环境下 kubernetes v1.16.2 单机部署说明

一.安装环境 本次部署使用阿里云ECS 操作系统: Ubuntu  18.04 64位 实例规格: ecs.c6.large 2U4G 二.kubernetes 版本 k8s.gcr.io/kube-apiserver:v1.16.2 k8s.gcr.io/kube-controller-manager:v1.16.2 k8s.gcr.io/kube-scheduler:v1.16.2 k8s.gcr.io/kube-proxy:v1.16.2 k8s.gcr.io/pause:3.1 k8s.

Ubuntu 18.04 desktop-允许使用管理员或者超级管理员 ssh登录

用ubuntu 18.04部署完docker后,用winscp去管理系统上的文件发现默认的管理员账号权限不够,想重新用root登录,发现一只被服务器拒绝(permission denied).已经执行过sudo passwd root设置了密码,但是没用,google了一下才知道需要修改系统设置允许远程登录root,果然服务器还是CentOS用的爽 背景: 发现可以ping通ubuntu18.04,而用putty登录ubuntu,则连接失败. 解决方案 1 默认不带ssh server,所以需要

Ubuntu 18.04 记录

登录后死机,关机时死机的解决方法 更新内核并安装 Nvidia 显卡驱动可解决. 在内核更新为 4.15.18,Nvidia 显卡驱动为 390 时,问题解决. 使用 LiveCD 启动,然后chroot到安装的系统的根分区.然后 sudo systemctl set-default multi-user.target 使系统启动后默认进入字符界面,从而避免登录后进入图形界面时死机. 进入字符界面登录后按照以下方式更新内核并安装 Nvidia 显卡驱动. 更新内核 内核下载地址 uname -s

Ubuntu 18.04上CUDA 9.0、cuDNN7.0及Tensorflow 1.8的安装

配置 笔者使用Dell Inspiron 7559笔记本电脑,显卡为NVIDIA GTX 960M. 目标 由于本机显卡仅有nvidia-384驱动包能够良好支持(nvidia-387.nvidia-390包均在本机出现了系统无法登陆等异常),而CUDA 9.1需要驱动至少为nvidia-387,故选择安装CUDA 9.0及cuDNN7.0. TelsorFlow 1.8完全支持CUDA 9.0因此可以使用最新版. 安装显卡驱动 使用apt安装nvidia-384驱动包(实际安装驱动为390):

Ubuntu 18.04 编译 ijkplayer

Ubuntu 18.04 编译 ijkplayer 1. 配置安装源 https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu 2. 配置好安装源后,安装一些组件 $ sudo apt update $ sudo apt install vim openssh-server git curl wget tar unzip $ sudo apt install build-essential openjdk-8-jdk yasm python 3. 下载sd