1. 程式人生 > >Docker Ubuntu Install

Docker Ubuntu Install

1、新增docker源

sudo cat >/etc/apt/sources.list.d/docker-main.list<<EOF

deb [arch=amd64] http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial main

EOF

2、Add Docker’s official GPG key:

apt install curl

curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -

3、更新源和升級系統

apt-get update

4、如果存在舊版本,則解除安裝舊版本docker

apt-get purge lxc-docker*

5、列出docker版本

apt-cache policy docker-engine

docker-engine:

  Installed: (none)

  Candidate: 17.05.0~ce-0~ubuntu-xenial

  Version table:

 17.05.0~ce-0~ubuntu-xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 17.04.0~ce-0~ubuntu-xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 17.03.1~ce-0~ubuntu-xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 17.03.0~ce-0~ubuntu-xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.13.1-0~ubuntu-xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.13.0-0~ubuntu-xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.12.6-0~ubuntu-xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.12.5-0~ubuntu-xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.12.4-0~ubuntu-xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.12.3-0~xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.12.2-0~xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.12.1-0~xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.12.0-0~xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.11.2-0~xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.11.1-0~xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

 1.11.0-0~xenial 500

500 http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-xenial/main amd64 Packages

6、安裝指定版本

apt-get install -y docker-engine=17.03.1~ce-0~ubuntu-xenial

7.離線安裝docker-compose

7.1 下載docker-compose檔案

wget -c https://github.com/docker/compose/releases/download/1.13.0/docker-compose-Linux-x86_64

7.2 移動docker-compose到/usr/local/bin/docker-compose

mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose

7.3修改許可權

sudo chmod +x /usr/local/bin/docker-compose

  1. docker-compose 使用

 docker-compose -f docker.yml up