Docker學習筆記——Docker安裝部署

1、系統環境

CentOS7.3

Docker需要安裝在64爲平臺上,並且內核版本不能低於3.10

[root@web-t ~]# uname -a
Linux web-t 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

2、Docker安裝

Docker官方提供了安裝腳本,可以直接使用

curl -sSL https://get.docker.com/ | sh

執行完成後,安裝完畢。

但是用這個腳本安裝的過程比較緩慢,建議使用國內的Docker鏡像源進行安裝

阿里雲的安裝腳本

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

DaoCloud的安裝腳本

curl -sSL https://get.daocloud.io/docker | sh

3、鏡像加速器

Docker安裝完畢後,默認使用Docker Hub作爲鏡像源,國內訪問時比較慢,而且經常報錯,使用過程中出現過如下錯誤

[root@web-t html]# docker pull nginx
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 172.30.0.18:53: too many redirects

網上給了很多建議,但我嘗試更換了一下DNS爲114.114.114.114或者8.8.8.8,報錯就消失了,應該是使用本地的DNS解析返回的地址使用用戶比較多,訪問請求被拒絕了。

更換爲阿里的鏡像加速器

進入阿里雲docker庫

https://dev.aliyun.com

註冊登錄後,點擊右上角 管理中心

進入控制檯後,點擊左側 Docker Hub鏡像站點獲取加速器地址

wKioL1mVUHfQhl79AAEUBJKZaMw553.jpg-wh_50

按照提示修改daemon配置文件,並重啓docker服務


配置完畢,來獲取一個mongo鏡像

[root@web-t ~]# docker pull mongo
Using default tag: latest
latest: Pulling from library/mongo
5233d9aed181: Pull complete 
5bbfc055e8fb: Pull complete 
aaf85a329dc4: Pull complete 
1360aef7d266: Pull complete 
9cb9d47c5d80: Pull complete 
80e12bf92c3c: Pull complete 
56b002b43f9a: Pull complete 
741d63bb9470: Pull complete 
c5b08545788b: Pull complete 
b51d4f928b3c: Pull complete 
e8c075c543c2: Pull complete 
Digest: sha256:127c37fd3713a87a24c9b9fdc87f215dccfd5fefb11d5765a3e3bee34431d67f
Status: Downloaded newer image for mongo:latest


 知行辦公,專業移動辦公平臺
【總監】十二春秋之,[email protected]
【Master】zelo,[email protected]
【運營】運維艄公[email protected]
【產品設計】流浪貓,[email protected]
【體驗設計】兜兜,[email protected]
【iOS】淘碼小工,[email protected];iMcG33K,[email protected]
【Android】人猿居士,[email protected];思路的頓悟,[email protected]
【java】首席工程師MR_W,[email protected]
【測試】土鏡問道,[email protected]
【數據】喜樂多,[email protected]
【安全】保密,你懂的。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章