Docker network error
由於Docker的執行,包含網路、硬碟、CPU與記憶體等等資源的分配,如果遇到Docker無法啟動時,有時候會造成整個系統錯誤,甚至重開... 原則上,可以透過dmesg, /var/log/*.log裡面的資訊來判斷當下是什麼原因造成...
如果您在檢查/var/log/daemon.log看到下面訊息的話...
Apr 3 11:16:38 raspberrypi systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Apr 3 11:16:38 raspberrypi systemd[1]: Failed to start Docker Application Container Engine.
Apr 3 11:16:38 raspberrypi systemd[1]: Unit docker.service entered failed state.
Apr 3 11:16:38 raspberrypi systemd[1]: Starting Docker Application Container Engine...
Apr 3 11:16:38 raspberrypi docker[2770]: time="2016-04-03T11:16:38.742872337Z" level=warning msg="devmapper: Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man docker` to refer to dm.thinpooldev section."
Apr 3 11:16:38 raspberrypi docker[2770]: time="2016-04-03T11:16:38.839698255Z" level=warning msg="devmapper: Base device already exists and has filesystem ext4 on it. User specified filesystem will be ignored."
Apr 3 11:16:38 raspberrypi docker[2770]: time="2016-04-03T11:16:38.928490295Z" level=info msg="[graphdriver] using prior storage driver \"devicemapper\""
Apr 3 11:16:39 raspberrypi docker[2770]: time="2016-04-03T11:16:39.130485019Z" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Apr 3 11:16:39 raspberrypi docker[2770]: time="2016-04-03T11:16:39.152423381Z" level=info msg="Firewalld running: false"
Apr 3 11:16:39 raspberrypi docker[2770]: time="2016-04-03T11:16:39.543909540Z" level=fatal msg="Error starting daemon: Error initializing network controller: could not delete the default bridge network: network bridge has active endpoints"
Apr 3 11:16:39 raspberrypi systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Apr 3 11:16:39 raspberrypi systemd[1]: Failed to start Docker Application Container Engine.
Apr 3 11:16:39 raspberrypi systemd[1]: Unit docker.service entered failed state.
Apr 3 11:16:39 raspberrypi systemd[1]: Starting Docker Application Container Engine...
packet_write_wait: Connection to 192.168.10.135: Broken pipe
其中重點部份是:"Error starting daemon: Error initializing network controller: could not delete the default bridge network: network bridge has active endpoints"... 這代表在network控制上有出現一些錯誤,而處理方式,比較簡單的就是reset docker執行環境的network紀錄...
處理方式
將/var/lib/docker裡面的network資料夾清空...
mv /var/lib/docker/network /var/lib/docker/network.bk
之後,重新啟動主機(或是啟動docker服務)...
# reboot
or
# /etc/init.d/docker start
之後,應該就可以正常使用docker了...