docker安裝后出現(xiàn)Cannot connect to the Docker daemon.
問(wèn)題描述
系統(tǒng):ubuntu16.04我是按照docker的文檔上安裝的 https://docs.docker.com/linux/step_one/安裝完成后docker的ps pull search run命令都會(huì)報(bào)這個(gè)錯(cuò) Cannot connect to the Docker daemon. Is the docker daemon running on this host?
在文檔上看到讓我檢查 DOCKER_HOST 這環(huán)境變量,然而我并不知道在哪檢查
問(wèn)題解答
回答1:我也出現(xiàn)過(guò)類似的錯(cuò)誤。因?yàn)椋彝泦?dòng)docker這個(gè)服務(wù)了。service docker start
回答2:請(qǐng)使用sudo
回答3:You need to add user into docker group. by ’sudo gpasswd -a xxxx docker’ (xxx is your user name)Then restart your computer.This problem should be solved.
回答4:docker-machine restart&&eval '$(docker-machine env default)'&&docker-machine env 運(yùn)行這么一串就好了
回答5:看下docker啟動(dòng)的默認(rèn)配置/etc/default/docker沒(méi)問(wèn)題唄,然后重啟服務(wù)service docker restart。
sudo docker -H unix:///var/run/docker.sock -d &使用 -H 可以改變docker進(jìn)程監(jiān)聽(tīng)指定的IP和端口。默認(rèn)情況下,docker會(huì)監(jiān)聽(tīng) unix:///var/run/docker.sock,只允許本地的root用戶連接。可以參考《Docker教程-學(xué)習(xí)基本命令》
重裝docker。
回答6:su root # 先切換到root用戶, 再執(zhí)行以下命令systemctl enable docker # 開(kāi)機(jī)自動(dòng)啟動(dòng)docker
systemctl start docker # 啟動(dòng)dockersystemctl restart docker # 重啟dokcer
相關(guān)文章:
1. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””2. MySQL數(shù)據(jù)庫(kù)中文亂碼的原因3. macos - mac下docker如何設(shè)置代理4. docker不顯示端口映射呢?5. docker - 各位電腦上有多少個(gè)容器啊?容器一多,自己都搞混了,咋辦呢?6. angular.js - angularjs的自定義過(guò)濾器如何給文字加顏色?7. docker gitlab 如何git clone?8. android studio總是在processes running好久9. java - 請(qǐng)問(wèn)在main方法中寫(xiě)成對(duì)象名.屬性()并賦值,與直接參參數(shù)賦值輸錯(cuò)誤是什么原因?10. css - C#與java開(kāi)發(fā)Windows程序哪個(gè)好?
