首页 > 网络 > 云计算 >

unbuntu安装docker

2017-02-06

unbuntu安装docker:ubuntu需要如下版本的64bit系统,使用下面的命令查看正在使用的ubuntu版本。

unbuntu安装docker:ubuntu需要如下版本的64bit系统,使用下面的命令查看正在使用的ubuntu版本。
Yakkety 16.10 Xenial 16.04 (LTS) Trusty 14.04 (LTS)
liujinliu@liujinliu-OptiPlex-7010:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:    16.04
Codename:   xenial

2. 安装一些包依赖

curl是接下来按照需要使用的,linux-image-extra-*使得你安装的docker可以使用aufs存储驱动

$ sudo apt-get update

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

3. 安装docker

1) 安装下面的包使得apt可以使用https的仓库地址

$ sudo apt-get install apt-transport-https \
                       ca-certificates

2) 导入官方的GPG key

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

使用下面的命令验证key ID 是 58118E89F3A912897C070ADBF76221572C52609D

$ apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D
pub   4096R/2C52609D 2015-07-14
      Key fingerprint = 5811 8E89 F3A9 1289 7C07  0ADB F762 2157 2C52 609D
uid                  Docker Release Tool (releasedocker) 

使用下面的命令将相应的软件仓库地址导入,如果想使用最新的(非稳定版本)的docker,可以在main后边加个testing,在生产环境是不推荐这样做的。
当然如果加完想去掉的话,直接编辑/etc/apt/sources.list就可以了,去掉最后的testing就可以了。

3) 安装docker

$ sudo apt-get update
$ sudo apt-get -y install docker-engine

上面的命令将安装最新稳定版本的docker,也可以安装某个特定版本的docker,下面的命令看当前都有哪些稳定版本

$ sudo apt-cache madison docker-engine
docker-engine | 1.13.0-0~ubuntu-xenial | https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
docker-engine | 1.12.6-0~ubuntu-xenial | https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
docker-engine | 1.12.5-0~ubuntu-xenial | https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
docker-engine | 1.12.4-0~ubuntu-xenial | https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
docker-engine | 1.12.3-0~xenial | https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
docker-engine | 1.12.2-0~xenial | https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
docker-engine | 1.12.1-0~xenial | https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
docker-engine | 1.12.0-0~xenial | https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
docker-engine | 1.11.2-0~xenial | https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
docker-engine | 1.11.1-0~xenial | https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
docker-engine | 1.11.0-0~xenial | https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages

安装特定版本的docker使用下面的命令

sudo apt-get -y install docker-engine=

下面的命令验证安装是否完成:

$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete 
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash
相关文章
最新文章
热点推荐