docker常見報錯

在我們實際使用docker的過程中,難免出現各種各樣的錯誤,下面我將自己遇到的比較難解決的錯誤和解決方法記錄下來。

1.docker啓動報錯一

(1).描述

docker啓動報錯 :Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a newer kernel or disabl...nabled=false)

(2).報錯情況

環境:Centos7

命令:systemctl start docker

  systemctl status docker.service

(3).解決方案

 

意思是此linux的內核中的SELinux不支持 overlay2 graph driver,重新編輯docker配置文件:

命令:vi /etc/sysconfig/docker   

原來配置:

改爲:

2.docker啓動報錯二

(1).描述

Job for docker.service failed because the control process exited with error code,

(2).解決方案

修改 /etc/docker/daemon.json文件,注意(中英文),修改爲如下內容:

3.docker中啓動鏡像時報錯

(1).描述

 oci runtime error: container_linux.go: starting the process: write pa rent: broken pipe"

(2).原因

linux內核版本太低

(3).解決

要執行命令, yum update ,更新完再重啓linux重啓docker重啓鏡像

注意:ubuntu系統安裝軟件的命令是 sudo apt-get software  (例如, sudo apt-get install -y docker.io)

         還有一部分linux系統是用yum,例如centos,安裝docker命令是,yum install docker

4.連接docker中的mysql docker容器出錯

(1).描述

docker中啓動mysql容器後,用navicat連接數據保存信息如下:

Client does not support authentication protocol 錯誤

(2).原因

mysql8 之前的版本中加密規則是mysql_native_password,而在mysql8之後,加密規則是caching_sha2_password

(3).解決方案

把mysql用戶登錄密碼加密規則還原成mysql_native_password

步驟:

        1>.進入mysql容器:docker exec -it container-id /bin/bash

        2>.連接mysql:mysql -u root -p  接着輸入密碼

        3>.修改加密規則:

                     不是虛擬機上的docker用下面這個:

                     ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; 

                     虛擬機上的docker用下面這個:

                     alter user 'root'@'%' identified with mysql_native_password by '123456';

         4>.刷新:FLUSH PRIVILEGES;

    重新連接,就能連接成功了。

 

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