Centos7上安装docker

docker安装

常见问题

  • 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
    

    参考链接:https://www.cnblogs.com/cxbhakim/p/8862758.html

  • 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
    

    参考链接:https://blog.csdn.net/hellofyy/article/details/80091635

  • 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,但是在我看来并不需要
    参考链接:https://www.cnblogs.com/xiashiwendao/p/7859815.html

  • 删除镜像时,提示:image is referenced in multiple repositories
    解决方案:
    删除时可以用repository和tag的方式来删除
    参考链接:https://blog.csdn.net/u013258415/article/details/80051082

转载于:https://my.oschina.net/u/1777269/blog/2236898

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值