docker安裝部署

1. 如何安裝 Epel源到 RHEL/CentOS 7/6/5?
  docker

RHEL/CentOS 7
rpm -ivh http://mirrors.ustc.edu.cn/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm


RHEL/CentOS 6 
## RHEL/CentOS 6 
# wget 
http://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
# rpm -ivh epel-release-6.noarch.rpm
如何檢查epel是否安裝成功?
使用一下命令:
# yum repolist 
[root@17-150 ~]# yum repolist 
已加載插件:fastestmirror
base | 3.6 kB 00:00:00 
epel/x86_64/metalink | 5.6 kB 00:00:00 
epel | 4.3 kB 00:00:00 
extras | 3.4 kB 00:00:00 
updates | 3.4 kB 00:00:00 
(1/5): extras/7/x86_64/primary_db | 191 kB 00:00:00 
(2/5): epel/x86_64/group_gz | 170 kB 00:00:00 
(3/5): epel/x86_64/updateinfo | 807 kB 00:00:01 
(4/5): updates/7/x86_64/primary_db | 7.8 MB 00:00:04 
(5/5): epel/x86_64/primary_db | 4.7 MB 00:01:05 
Determining fastest mirrors
* base: centos.ustc.edu.cn
* epel: mirrors.ustc.edu.cn
* extras: mirrors.sohu.com
* updates: mirrors.sohu.com
源標識 源名稱 狀態
base/7/x86_64 CentOS-7 - Base 9,363
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 11,769
extras/7/x86_64 CentOS-7 - Extras 449
updates/7/x86_64 CentOS-7 - Updates 2,146
repolist: 23,727

2. 安裝docker-ioshell

yum -y install docker-io 
yum install docker-engine

3. 啓動docker服務json

/etc/init.d/docker start 
Starting cgconfig service: [ OK ] 
Starting docker: [ OK ] 

chkconfig docker on #設置docker服務開機啓動
 


4. docker命令補全
  安裝docker自帶包:
  缺乏下面的包,TAB會報錯centos

yum install -y bash-completion
sh /usr/share/bash-completion/bash_completion  或者執行 source /usr/share/bash-completion/completions/docker

  顯然,該腳本是用於bash自動補全的,可是,不幸的是,直接 source 執行該腳本後,docker命令後敲tab,有以下錯誤: bash

docker -bash: _get_comp_words_by_ref: command not found 
-bash: [: 1: unary operator expected 
-bash: [: 1: unary operator expected 
-bash: [: -eq: unary operator expected 
-bash: _get_comp_words_by_ref: command not found 
-bash: [: 1: unary operator expected 
-bash: [: 1: unary operator expected 
-bash: [: -eq: unary operator expected

  難道docker的bash自動補全還能有問題? curl

解決辦法以下:
  我這裏雖然安裝了bash-completion ,可是沒有執行其中的一個文件:
  /usr/share/bash-completion/bash_completion 
  該文件中有上面缺乏的命令,執行該文件,從新開一個shell終端 就解決了。
5. 如何使用docker加速器
  安裝/升級你的Docker客戶端
  推薦安裝1.10.0以上版本的Docker客戶端。
  您能夠經過阿里雲的鏡像倉庫下載:docker-engine、docker-ce
  或執行如下命令:阿里雲

curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -

  針對Docker客戶端版本大於1.10的用戶url

  您能夠經過修改daemon配置文件/etc/docker/daemon.json來使用加速器:spa

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://sv1txjq6.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

6. 阿里雲鏡像站
  http://mirrors.aliyun.com/插件

相關文章
相關標籤/搜索