Install Docker on Ubuntu 16.04

Installing docker on Ubuntu 16.04 is a very troublesome thing, but given the various advantages of docker, it is still bearable.
Refer to the docker official website .

1. Choose a domestic cloud service provider, here we choose Alibaba Cloud as an example

curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -

2. Install the required packages

  sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual

3. Add the package transmitted using HTTPS and the CA certificate

  sudo apt-get update
  sudo apt-get install apt-transport-https ca-certificates

4. Add GPG key

  sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

5. Add software source

  echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list

6. Update the package cache after adding successfully

  sudo apt-get update

7. Install docker

  sudo apt-get install docker-engine

8. Start docker

  sudo systemctl enable docker
  sudo systemctl start docker

9. It is recommended to use an accelerator in China!
The steps to obtain the accelerator: Go to the
website
https://account.aliyun.com/login/login.htm?oauth_callback=https%3A%2F%2Fcr.console.aliyun.com%2F&lang =zh#/accelerator
log in with their own Taobao account, new users skip all the steps, enter the docker image warehouse, click the accelerator below, and automatically get the accelerator, as shown in the figure below


10. Add accelerator address to docker

  systemctl enable docker
  sudo vim /etc/systemd/system/multi-user.target.wants/docker.service

Find the line ExecStart= in the opened file and modify its content to:

  ExecStart=/usr/bin/dockerd --registry-mirror=(你自己获得的加速器地址)

11. Restart docker

 

  sudo systemctl daemon-reload
  sudo systemctl restart docker

 

  

Install docker ce command record under ubuntu

   
First, if you have installed docker 
  docker-engine these, need to be uninstalled
sudo apt-get remove docker docker-engine docker.io

然后,依次进行以下操作
sudo apt-get update

sudo apt-get install \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual

sudo apt-get update

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

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

sudo apt-key fingerprint 0EBFCD88

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


sudo apt-get update

sudo apt-get install docker-ce

注:由于XX原因,可能通过apt install下载会经常性的失败,可以访问 

 https://download.docker.com/linux/ubuntu/dists/
选择你的系统版本,例如16。04选择 xenial
再选择 pool/stable/ amd64(一般都是这个)
最终目录为
https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/
下载.deb,然后安装

dpkg -i file.deb


安装完毕,其中每步的具体意义请参考官方文档
https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-using-the-repository

另外,收藏一个DOCKER的教程,个人感觉入门非常实用,感谢作者的无私分享。
每天5分钟玩转docker技术 : cloudman6

安装完毕后,想要在大中华局域网内正常的使用,还需要进行国内源的设置
本人使用过阿里和daocloud的,设置和实际速度都差不太多,(以下操作需要你有该网站账号)

1/阿里的,访问
https://cr.console.aliyun.com/#/accelerator
将会获得类似 https://abcdefghijkl.mirror.aliyuncs.com
的地址,然后修改你的配置文件
sudo gedit /etc/docker/daemon.json
加入
{"registry-mirrors": ["https://abcdefghijkl.mirror.aliyuncs.com"]}
注:没有该文件,自己建立(mkdir xxxx  touch xxx.json sudo vi xxx.json  :wq还不明白请百度)。
然后运行
sudo systemctl daemon-reload

sudo systemctl restart docker

2/ daocloud的 访问
https://www.daocloud.io/mirror#accelerator-doc
他会让你下载一个脚本运行,其实起到的作用和刚才完全一下,给你建一个daemon.json,增加镜像地址,然后重起docker

然后,你拖镜像的时候,会有飞快的感觉了。
其他系统的设置,可参考
https://github.com/yeasy/docker_practice/blob/master/install/mirror.md

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326174291&siteId=291194637