Docker如何安裝與卸載

這篇文章將為大家詳細(xì)講解有關(guān)Docker如何安裝與卸載,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

目前創(chuàng)新互聯(lián)已為成百上千的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬主機(jī)、網(wǎng)站托管、企業(yè)網(wǎng)站設(shè)計(jì)、沙坪壩網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶(hù)導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶(hù)和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。

準(zhǔn)備工作

系統(tǒng):centos6.x

安裝

1. 關(guān)閉seLinux

vim /etc/selinux/config

修改后的值: SELINUX=disabled

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

查看狀態(tài):sestatus

狀態(tài)不為disabled,則重啟

[root@iZwz9eczt2tstmhvm8mv25Z docker]# sestatus
SELinux status:                 disabled
[root@iZwz9eczt2tstmhvm8mv25Z docker]#

2. 安裝epel源

下載wget http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

# wget http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
--2017-04-25 09:55:43--  http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
正在解析主機(jī) ftp.riken.jp... 134.160.38.1
正在連接 ftp.riken.jp|134.160.38.1|:80... 已連接。
已發(fā)出 HTTP 請(qǐng)求,正在等待回應(yīng)... 200 OK
長(zhǎng)度:14540 (14K) [text/plain]
正在保存至: “epel-release-6-8.noarch.rpm”

100%[======================================>] 14,540      43.5K/s   in 0.3s    

2017-04-25 09:55:46 (43.5 KB/s) - 已保存 “epel-release-6-8.noarch.rpm” [14540/14540])

[root@iZwz9eczt2tstmhvm8mv25Z docker]# ls
epel-release-6-8.noarch.rpm
[root@iZwz9eczt2tstmhvm8mv25Z docker]#

安裝rpm -ivh epel-release-6-8.noarch.rpm

[root@iZwz9eczt2tstmhvm8mv25Z docker]# rpm -ivh epel-release-6-8.noarch.rpm 
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           warning: /etc/yum.repos.d/epel.repo created as /etc/yum.repos.d/epel.repo.rpmnew
########################################### [100%]
[root@iZwz9eczt2tstmhvm8mv25Z docker]#

3. 安裝lxc與libcgroup

yum install lxc libcgroup

[root@iZwz9eczt2tstmhvm8mv25Z docker]# yum install lxc libcgroup
Loaded plugins: security
base                                                     | 3.7 kB     00:00     
epel                                                     | 4.3 kB     00:00     
epel/primary_db                                          | 5.9 MB     00:05     
extras                                                   | 3.4 kB     00:00     
updates                                                  | 3.4 kB     00:00     
updates/primary_db                                       | 803 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libcgroup.x86_64 0:0.40.rc1-23.el6 will be installed
---> Package lxc.x86_64 0:1.0.9-1.el6 will be installed
--> Processing Dependency: lua-lxc(x86-64) = 1.0.9-1.el6 for package: lxc-1.0.9-1.el6.x86_64
--> Processing Dependency: lua-alt-getopt for package: lxc-1.0.9-1.el6.x86_64
--> Processing Dependency: liblxc.so.1()(64bit) for package: lxc-1.0.9-1.el6.x86_64
--> Running transaction check
---> Package lua-alt-getopt.noarch 0:0.7.0-1.el6 will be installed
---> Package lua-lxc.x86_64 0:1.0.9-1.el6 will be installed
--> Processing Dependency: lua-filesystem for package: lua-lxc-1.0.9-1.el6.x86_64
---> Package lxc-libs.x86_64 0:1.0.9-1.el6 will be installed
--> Running transaction check
---> Package lua-filesystem.x86_64 0:1.4.2-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package               Arch          Version                  Repository   Size
================================================================================
Installing:
 libcgroup             x86_64        0.40.rc1-23.el6          base        131 k
 lxc                   x86_64        1.0.9-1.el6              epel        122 k
Installing for dependencies:
 lua-alt-getopt        noarch        0.7.0-1.el6              epel        6.9 k
 lua-filesystem        x86_64        1.4.2-1.el6              epel         24 k
 lua-lxc               x86_64        1.0.9-1.el6              epel         16 k
 lxc-libs              x86_64        1.0.9-1.el6              epel        257 k

Transaction Summary
================================================================================
Install       6 Package(s)

Total download size: 557 k
Installed size: 1.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): libcgroup-0.40.rc1-23.el6.x86_64.rpm              | 131 kB     00:00     
(2/6): lua-alt-getopt-0.7.0-1.el6.noarch.rpm             | 6.9 kB     00:00     
(3/6): lua-filesystem-1.4.2-1.el6.x86_64.rpm             |  24 kB     00:00     
(4/6): lua-lxc-1.0.9-1.el6.x86_64.rpm                    |  16 kB     00:00     
(5/6): lxc-1.0.9-1.el6.x86_64.rpm                        | 122 kB     00:00     
(6/6): lxc-libs-1.0.9-1.el6.x86_64.rpm                   | 257 kB     00:00     
--------------------------------------------------------------------------------
Total                                           675 kB/s | 557 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:
2:postfix-2.6.6-6.el6_5.x86_64 has missing requires of libMySQLclient.so.16()(64bit)
2:postfix-2.6.6-6.el6_5.x86_64 has missing requires of libmysqlclient.so.16(libmysqlclient_16)(64bit)
2:postfix-2.6.6-6.el6_5.x86_64 has missing requires of mysql-libs
  Installing : lxc-libs-1.0.9-1.el6.x86_64                                  1/6 
  Installing : lua-filesystem-1.4.2-1.el6.x86_64                            2/6 
  Installing : lua-lxc-1.0.9-1.el6.x86_64                                   3/6 
  Installing : lua-alt-getopt-0.7.0-1.el6.noarch                            4/6 
  Installing : lxc-1.0.9-1.el6.x86_64                                       5/6 
  Installing : libcgroup-0.40.rc1-23.el6.x86_64                             6/6 
  Verifying  : lua-lxc-1.0.9-1.el6.x86_64                                   1/6 
  Verifying  : lxc-libs-1.0.9-1.el6.x86_64                                  2/6 
  Verifying  : lxc-1.0.9-1.el6.x86_64                                       3/6 
  Verifying  : lua-alt-getopt-0.7.0-1.el6.noarch                            4/6 
  Verifying  : libcgroup-0.40.rc1-23.el6.x86_64                             5/6 
  Verifying  : lua-filesystem-1.4.2-1.el6.x86_64                            6/6 

Installed:
  libcgroup.x86_64 0:0.40.rc1-23.el6          lxc.x86_64 0:1.0.9-1.el6         

Dependency Installed:
  lua-alt-getopt.noarch 0:0.7.0-1.el6    lua-filesystem.x86_64 0:1.4.2-1.el6   
  lua-lxc.x86_64 0:1.0.9-1.el6           lxc-libs.x86_64 0:1.0.9-1.el6         

Complete!
[root@iZwz9eczt2tstmhvm8mv25Z docker]#

4. 安裝docker-io

yum install docker-io

[root@iZwz9eczt2tstmhvm8mv25Z docker]# yum install docker-io
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:1.7.1-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch            Version                 Repository     Size
================================================================================
Installing:
 docker-io          x86_64          1.7.1-2.el6             epel          4.6 M

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 4.6 M
Installed size: 19 M
Is this ok [y/N]: y 
Downloading Packages:
docker-io-1.7.1-2.el6.x86_64.rpm                         | 4.6 MB     00:04     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : docker-io-1.7.1-2.el6.x86_64                                 1/1 
  Verifying  : docker-io-1.7.1-2.el6.x86_64                                 1/1 

Installed:
  docker-io.x86_64 0:1.7.1-2.el6                                                

Complete!
[root@iZwz9eczt2tstmhvm8mv25Z docker]#

5. 啟動(dòng)docker進(jìn)程

/etc/init.d/docker start

[root@iZwz9eczt2tstmhvm8mv25Z docker]# /etc/init.d/docker start
Starting cgconfig service:                                 [  OK  ]
Starting docker:                                       [確定]
[root@iZwz9eczt2tstmhvm8mv25Z docker]#

6. 查看docker進(jìn)程

ps -ef|grep docker or /etc/init.d/docker status

卸載

yum remove docker-io

常見(jiàn)問(wèn)題

啟動(dòng)不了

查看啟動(dòng)日志

docker -d

[root@iZwz9eczt2tstmhvm8mv25Z docker]# /etc/init.d/docker status
docker 已死,但 pid 文件仍存
[root@iZwz9eczt2tstmhvm8mv25Z docker]# docker -d
WARN[0000] You are running linux kernel version 2.6.32-573.22.1.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0. 
docker: relocation error: docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference
[root@iZwz9eczt2tstmhvm8mv25Z docker]#

解決方式

安裝:yum install device-mapper-event-libs

重啟并查看其狀態(tài)

[root@iZwz9eczt2tstmhvm8mv25Z docker]# /etc/init.d/docker restart
停止 docker:                                              [失敗]
Starting docker:                                       [確定]
[root@iZwz9eczt2tstmhvm8mv25Z docker]# /etc/init.d/docker status
docker (pid  17162) 正在運(yùn)行...
[root@iZwz9eczt2tstmhvm8mv25Z docker]#

關(guān)于“Docker如何安裝與卸載”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

本文名稱(chēng):Docker如何安裝與卸載
文章出自:http://muchs.cn/article36/jcjgsg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)軟件開(kāi)發(fā)、微信小程序、品牌網(wǎng)站建設(shè)、網(wǎng)站內(nèi)鏈、動(dòng)態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

手機(jī)網(wǎng)站建設(shè)