docker:如果提示gpg: 找不到有效的 OpenPGP 數據。先添加pgp key

安裝curl

獲取並安裝docker

sudo curl -fsSL https://get.docker.com/| sh

如果提示gpg: 找不到有效的 OpenPGP 數據。先添加pgp key

sudocurl -fsSL https://get.docker.com/gpg | sudo apt-key add -

再執行獲取包的命令,在國內網絡問題可能安裝失敗,因爲已經添加過源列表,可以直接執行

sudo apt-get update

sudo apt-get install docker-engine

3.測試docker

docker run hello-world

如果出現這個錯誤:Cannot connect to the Docker daemon. Is the docker daemon running on this host?的解決方法:

先執行命令docker daemon 看出現什麼錯誤

FATA[0000] Error starting daemon: Devices cgroup isn't mounted

該錯誤是因爲我們系統未打開cgroup引起的(Cgroup: control group是將任意進程進行分組化管理的Linux內核功能,具體百度)

解決方法:修改grub文件,打開cgroup,重啓系統

編輯/etc/default/grub:將GRUB_CMDLINE_LINUX設置爲
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
sudo update-grub
reboot
docker version

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