阿里云安裝docker全過程
阿里云安裝docker
記錄阿里云搭建docker碰到的問題
阿里云搭建docker和本地有一點點區(qū)別,當安裝成功后發(fā)現(xiàn)docker報錯,如下:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
/var/run/docker.sock is up time="2017-09-20T19:43:04.189684169+08:00" level=info msg="libcontainerd: new containerd process, pid: 17504" time="2017-09-20T19:43:05.195018039+08:00" level=info msg="[graphdriver] using prior storage driver: aufs" time="2017-09-20T19:43:05.202361669+08:00" level=info msg="Graph migration to content-addressability took 0.00 seconds" time="2017-09-20T19:43:05.202628053+08:00" level=warning msg="Your kernel does not support swap memory limit" time="2017-09-20T19:43:05.202683626+08:00" level=warning msg="Your kernel does not support cgroup rt period" time="2017-09-20T19:43:05.202699519+08:00" level=warning msg="Your kernel does not support cgroup rt runtime" time="2017-09-20T19:43:05.202842112+08:00" level=warning msg="mountpoint for pids not found" time="2017-09-20T19:43:05.203338693+08:00" level=info msg="Loading containers: start." Error starting daemon: Error initializing network controller: list bridge addresses failed: no available network /var/run/docker.sock is up time="2017-09-20T19:43:05.344214220+08:00" level=info msg="libcontainerd: new containerd process, pid: 17581" time="2017-09-20T19:43:06.349392877+08:00" level=info msg="[graphdriver] using prior storage driver: aufs" time="2017-09-20T19:43:06.354159926+08:00" level=info msg="Graph migration to content-addressability took 0.00 seconds" time="2017-09-20T19:43:06.354370574+08:00" level=warning msg="Your kernel does not support swap memory limit" time="2017-09-20T19:43:06.354434193+08:00" level=warning msg="Your kernel does not support cgroup rt period" time="2017-09-20T19:43:06.354450955+08:00" level=warning msg="Your kernel does not support cgroup rt runtime" time="2017-09-20T19:43:06.354525824+08:00" level=warning msg="mountpoint for pids not found" time="2017-09-20T19:43:06.355017538+08:00" level=info msg="Loading containers: start." Error starting daemon: Error initializing network controller: list bridge addresses failed: no available network /var/run/docker.sock is up
可以發(fā)現(xiàn)是網(wǎng)絡(luò)有問題,然后用ifconfig查看,果然沒有docker0這塊虛擬網(wǎng)卡。
那么,在阿里云中為什么會啟動失敗呢?在Docker的源代碼搜索上述錯誤信息,可以看出問題出在createBridge這個函數(shù)中。
該函數(shù)會檢查下列IP段
var addrs = []string{
“172.17.42.1/16”,
“10.0.42.1/16”,
“10.1.42.1/16”,
“10.42.42.1/16”,
“172.16.42.1/24”,
“172.16.43.1/24”,
“172.16.44.1/24”,
“10.0.42.1/24”,
“10.0.43.1/24”,
“192.168.42.1/24”,
“192.168.43.1/24”,
“192.168.44.1/24”,
}對于每個IP段,Docker會檢查它是否和當前機器的域名服務(wù)器或路由表有重疊,如果有的話,就放棄該IP段。
讓我們看看阿里云服務(wù)器的路由表
root@iZ:/home/docker# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 114.55.11.247 0.0.0.0 UG 0 0 0 eth1 10.0.0.0 10.45.55.247 255.0.0.0 UG 0 0 0 eth0 10.45.52.0 0.0.0.0 255.255.252.0 U 0 0 0 eth0 100.64.0.0 10.45.55.247 255.192.0.0 UG 0 0 0 eth0 114.55.8.0 0.0.0.0 255.255.252.0 U 0 0 0 eth1 172.16.0.0 10.45.55.247 255.240.0.0 UG 0 0 0 eth0 192.168.0.0 10.45.55.247 255.255.0.0 UG 0 0 0 eth0
把路由表中不用的項刪除,這樣Docker就能找到能用的IP段了:
sudo route del -net 172.16.0.0/12
service docker start
好了問題解決
這時候可以用docker images查看鏡像信息了:
root@iZ:/home/docker# docker images REPOSITORY ? ? ? ? ?TAG ? ? ? ? ? ? ? ? IMAGE ID ? ? ? ? ? ?CREATED ? ? ? ? ? ? SIZE
總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
在 Centos 7.9 中如何安裝與配置 Docker 20.10.
這篇文章主要介紹了在 Centos 7.9 中如何安裝與配置 Docker 20.10.18,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友參考下吧2024-01-01
項目訪問使用docker bridge網(wǎng)絡(luò)模式(端口映射)配置過程
這篇文章主要介紹了項目訪問使用docker bridge網(wǎng)絡(luò)模式(端口映射)配置過程,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2025-03-03
2025最新Docker國內(nèi)可用鏡像源倉庫地址分享
在使用Docker時,您是否經(jīng)常遇到拉取鏡像緩慢或下載中斷的問題?特別是對于我們在國內(nèi)的開發(fā)者,網(wǎng)絡(luò)條件限制常常導致鏡像下載速度令人頭疼,為了讓您的開發(fā)工作更加順暢,小編特意收集并整理了2025年最新、可用的國內(nèi)Docker鏡像源地址,希望能大幅提升您的Docker下載速度2025-02-02
zabbix監(jiān)控docker應(yīng)用配置
今天通過本文給大家分享zabbix監(jiān)控docker容器的原理及部署的方法,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友參考下吧2021-07-07

