ubuntu16.10安裝docker17.03.0-ce並配置國內源和加速器

https://www.cnblogs.com/wish123/p/6501569.html


ubuntu16.10安裝docker17.03.0-ce並配置國內源和加速器

2017-03-04 15:41 by wish123, 3284 閱讀, 0 評論, 收藏, 編輯

說明:這個針對docker-ce安裝,ce和ee的區別是前者是社區版,後者是企業版

1.  配置Ubuntu的源,不然慢的去哭吧。參考http://cn.archive.ubuntu.com/help/ubuntuhttps://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ 注意版本要對應。我的源配置見附件sources.list

2. 安裝docker,按照官方教程https://docs.docker.com/engine/installation/linux/ubuntu/

環境依賴

sudo apt-get update
sudo apt-get install \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual

安裝docker包

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common 

添加docker官方GPG祕鑰

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

安裝穩定版倉庫

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

再次更新源

sudo apt-get update

安裝docker-ce

sudo apt-get install docker-ce
 

3. 給docker添加國內加速器(參考https://github.com/yeasy/docker_practice/blob/master/install/mirror.md)

在阿里雲申請一個賬號,打開連接https://cr.console.aliyun.com/#/accelerator 拷貝您的專屬加速器地址,然後/etc/systemd/system/multi-user.target.wants/docker.service 文件,找到 ExecStart= 這一行,在這行最後添加加速器地址 --registry-mirror=<加速器地址>

ExecStart=/usr/bin/dockerd --registry-mirror=https://jxus37ad.mirror.aliyuncs.com

注:對於 1.12 以前的版本,dockerd 換成 docker daemon

重新加載配置並且重新啓動

sudo systemctl daemon-reload
sudo systemctl restart docker
 

至此docker安裝及國內加速器都好了,開始你的docker之旅吧。

hello-word

sudo docker run hello-world
 
如需要設置代理參考:http://wish.leanote.com/post/a681ceddcbd1 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章