天天看點

docker學習筆記002-docker-engine安裝過程

虛拟機核心版本:

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

安裝依賴

~]$ sudo yum install -y libcgroup-*

~]$ 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,

~]$ 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 :

xz-libs.i686 :

Libraries for decoding LZMA compression

xz-libs.x86_64 :

xz-lzma-compat.x86_64

: Older LZMA format compatibility binaries

  Name and summary matches only, use

"search all" for everything.

~]$ sudo yum install -y xz-*

error: can't create

transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)

~]$ sudo rpm -ivh docker-engine-1.7.1-1.el6.x86_64.rpm

Preparing...               

########################################### [100%]

   1:docker-engine         

查詢已安裝的docker

~]$ yum list installed | grep docker

docker-engine.x86_64                 1.7.1-1.el6                      installed

~]$

~]$ ps -ef|grep docker

baseuser  4460 

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

~]$ sudo service docker start

[sudo]

password for baseuser:

Starting

cgconfig service:                                 [  OK  ]

docker:                                           [  OK  ]

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

~]$ 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:

For more

examples and ideas, visit:

~]$ 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

~]$ docker version

Client

version: 1.7.1

API version: 1.19

Go

version (client): go1.4.2

Git

commit (client): 786b29d

OS/Arch

(client): linux/amd64

Server

version (server): go1.4.2

commit (server): 786b29d

(server): linux/amd64

解除安裝

删除安裝包

~]$ sudo yum -y remove docker-engine.x86_64

 以上安裝過程。