docker学习笔记002-docker-engine安装过程

  1. 云栖社区>
  2. 博客>
  3. 正文

docker学习笔记002-docker-engine安装过程

浦涛 2017-12-15 14:42:26 浏览2369
展开阅读全文

虚拟机内核版本:

Linux SHDL009020142 2.6.32-642.el6.x86_64 #1 SMP Wed Apr 13 00:51:26 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

采用手动安装方式,安装docker-engine


直接下载文件安装

[baseuser@SHDL009020139 ~]$ wget https://yum.dockerproject.org/repo/main/centos/6/Packages/docker-engine-1.7.1-1.el6.x86_64.rpm

 

安装依赖

[baseuser@SHDL009020139 ~]$ sudo yum install -y libcgroup-*

[baseuser@SHDL009020139 ~]$ rpm -ivh docker-engine-1.7.1-1.el6.x86_64.rpm

warning: docker-engine-1.7.1-1.el6.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 2c52609d: NOKEY

error: Failed dependencies:

xz is needed by docker-engine-1.7.1-1.el6.x86_64

 

报错提示安装依赖XZ

[baseuser@SHDL009020139 ~]$ yum search xz

Loaded plugins: product-id, search-disabled-repos, subscription-manager

=========================================================== N/S Matched: xz ===========================================================

xz.x86_64 : LZMA compression utilities

xz-devel.i686 : Devel libraries & headers for liblzma

xz-devel.x86_64 : Devel libraries & headers for liblzma

xz-libs.i686 : Libraries for decoding LZMA compression

xz-libs.x86_64 : Libraries for decoding LZMA compression

xz-lzma-compat.x86_64 : Older LZMA format compatibility binaries

 

  Name and summary matches only, use "search all" for everything.

 

[baseuser@SHDL009020139 ~]$ sudo yum install -y xz-*

 

[baseuser@SHDL009020139 ~]$ rpm -ivh docker-engine-1.7.1-1.el6.x86_64.rpm

warning: docker-engine-1.7.1-1.el6.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 2c52609d: NOKEY

error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)

[baseuser@SHDL009020139 ~]$ sudo rpm -ivh docker-engine-1.7.1-1.el6.x86_64.rpm

warning: docker-engine-1.7.1-1.el6.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 2c52609d: NOKEY

Preparing...                ########################################### [100%]

   1:docker-engine          ########################################### [100%]

查询已安装的docker

[baseuser@SHDL009020139 ~]$ yum list installed | grep docker

docker-engine.x86_64                 1.7.1-1.el6                      installed

[baseuser@SHDL009020139 ~]$

 

[baseuser@SHDL009020139 ~]$ ps -ef|grep docker

baseuser  4460  3491  0 11:43 pts/0    00:00:00 grep docker

[baseuser@SHDL009020139 ~]$ sudo service docker start

[sudo] password for baseuser:

Starting cgconfig service:                                 [  OK  ]

Starting docker:                                           [  OK  ]

[baseuser@SHDL009020139 ~]$ ps -ef|grep docker

root      4506     1  2 11:44 pts/0    00:00:00 /usr/bin/docker -d

baseuser  4622  3491  0 11:44 pts/0    00:00:00 grep docker

 

[baseuser@SHDL009020139 ~]$ sudo docker run hello-world

 

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

 

Share images, automate workflows, and more with a free Docker ID:

 https://cloud.docker.com/

 

For more examples and ideas, visit:

 https://docs.docker.com/engine/userguide/

 

 

 

[baseuser@SHDL009020139 ~]$ sudo docker ps -a

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES

e5f07cbd2647        hello-world         "/hello"            33 seconds ago      Exited (0) 32 seconds ago                       grave_turing

 

[baseuser@SHDL009020139 ~]$ docker version

Client version: 1.7.1

Client API version: 1.19

Go version (client): go1.4.2

Git commit (client): 786b29d

OS/Arch (client): linux/amd64

Server version: 1.7.1

Server API version: 1.19

Go version (server): go1.4.2

Git commit (server): 786b29d

OS/Arch (server): linux/amd64

[baseuser@SHDL009020139 ~]$

 

卸载

[baseuser@SHDL009020139 ~]$ yum list installed | grep docker

docker-engine.x86_64                 1.7.1-1.el6                      installed

删除安装包

[baseuser@SHDL009020139 ~]$ sudo yum -y remove docker-engine.x86_64

[baseuser@SHDL009020139 ~]$ yum list installed | grep docker

[baseuser@SHDL009020139 ~]$

 

 以上安装过程。


网友评论

登录后评论
0/500
评论