Centos7上安裝docker

qijian0503發表於2018-09-27

docker安裝

  • 線上安裝
    yum install docker
    複製程式碼
  • 啟用服務
    systemctl start docker
    複製程式碼
  • 開機啟動
    systemctl enable docker
    複製程式碼
    檢視連結:
    www.cnblogs.com/yufeng218/p…

常見問題

  • docker執行映象的時候,提示:docker-runc not installed on system

    [root@iZbp1jcwx7sfb1yrnvpg84Z docker]# docker run hello-world
    shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    Unable to find image 'hello-world:latest' locally
    Trying to pull repository docker.io/library/hello-world ... 
    sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788: Pulling from docker.io/library/hello-world
    d1725b59e92d: Pull complete 
    Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
    Status: Downloaded newer image for docker.io/hello-world:latest
    /usr/bin/docker-current: Error response from daemon: shim error: docker-runc not installed on system.
    
    複製程式碼

    解決方案:

    [root@iZbp1jcwx7sfb1yrnvpg84Z docker]# cd /usr/libexec/docker/
    [root@iZbp1jcwx7sfb1yrnvpg84Z docker]# ln -s docker-runc-current docker-runc
    複製程式碼

    參考連結:www.cnblogs.com/cxbhakim/p/…

  • docker執行映象的時候,提示:exec: "docker-proxy": executable file not found in $PATH

    [root@iZbp1jcwx7sfb1yrnvpg84Z docker]# docker run -d -p 5000:5000 -v /home/datas/registry:/var/lib/registry registry
    acae4d30d40cdb209d86377505bab5215ef37c66a863033b16909719e1c76a53
    /usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint agitated_engelbart (7f225ce7048177e8ee4c5d77161bcf9d8bcc2597ea8307d1a10bcc3c9b20a4d3): exec: "docker-proxy": executable file not found in $PATH.
    
    複製程式碼

    解決方案:

    [root@iZbp1jcwx7sfb1yrnvpg84Z bin]# cd /usr/libexec/docker/
    [root@iZbp1jcwx7sfb1yrnvpg84Z docker]# ln -s docker-proxy-current docker-proxy
    複製程式碼

    參考連結:blog.csdn.net/hellofyy/ar…

  • docker執行映象的時候,提示:Bind for 0.0.0.0:5000 failed: port is already allocated

    除錯這個問題花費了好長時間,因為無法通過netstat以及lsof看到究竟是什麼應用佔用了程式;後來我才發現原來是因為docker的原因;如果docker被run了兩次

    [root@iZbp1jcwx7sfb1yrnvpg84Z docker]# docker run -d -p 5000:5000 -v /home/datas/registry:/var/lib/registry registry
    d6e57a3ed2bad6671df31acdc83cd32b9b6a136d2874ed34b77c99e37a858177
    /usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint ecstatic_goldstine (2521adff22666e908e773d6288ca03a30229aade2a1d68e8fcb250254fdc3353): Bind for 0.0.0.0:5000 failed: port is already allocated.
    複製程式碼

    第一次失敗,那麼這個埠將會被一直佔用,即使docker容器並沒有建立。
    解決方案:

    #重啟docker服務
    service docker restart
    複製程式碼

    也有人說要sudo rm /var/lib/docker/network/files/local-kv.db,但是在我看來並不需要
    參考連結:www.cnblogs.com/xiashiwenda…

  • 刪除映象時,提示:image is referenced in multiple repositories
    解決方案:
    刪除時可以用repository和tag的方式來刪除
    參考連結:blog.csdn.net/u013258415/…

相關文章