CentOS7 Docker 安裝

 

 CentOS7 已經內置了docker ,能夠直接安裝html

安裝Dockerlinux

  命令: sudo yum install -y dockerdocker

   

 啓動docker json

  命令: service docker startvim

  發現會出現異常阿里雲

  沒法啓動:
  按照提示執行:
  命令: systemctl status docker.servicespa

     這是因爲overlay2不支持形成的,因此咱們要關閉它3d

   命令: vim /etc/sysconfig/docker rest

  進入修改配置  selinux-enabled=falsecode

  

  

     再次執行  service docker start

 執行命令: docker -v  
啓動成功。

 

 修改Docker鏡像加速器

   國外的docker鏡像訪問速度太慢 因此咱們能夠修改爲阿里的docker鏡像。這樣速度會快不少。 

  1.打開阿里雲docker倉庫地址https://dev.aliyun.com/search.html

  2.淘寶帳號便可登陸,登陸後點擊本身的管理中心。

  3.點擊管理中心左側菜單欄的「鏡像加速器」,右邊面板會有你的加速地址,面板下面有詳細設置步驟。以下圖:

  

root@localhost ~]# vi /etc/docker/daemon.json

   將下面整行字符拷貝進去,保存並退出

"registry-mirrors": ["https://xrij41fy.mirror.aliyuncs.com"]

  :wq!

  刷新daemon

[root@localhost ~]# systemctl daemon-reload

 重啓docker

[root@localhost ~]# systemctl restart docker

  

拉取鏡像

以hello-world爲例

複製代碼
[root@localhost tmp]# docker pull hello-world
Using default tag: latest
Trying to pull repository docker.io/library/hello-world ... 
latest: Pulling from docker.io/library/hello-world
9bb5a5d4561a: Pull complete 
Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77
Status: Downloaded newer image for docker.io/hello-world:latest
複製代碼

 表示成功拉取

 

 運行鏡像

複製代碼
[root@localhost tmp]# docker run hello-world
相關文章
相關標籤/搜索