docker操作常见错误

错误1:

ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

Is your docker engine running ?

$ sudo service docker status

Is your user in docker user group ?

You need to use sudo if your user is not in docker user group. Even you used sudo, you may encounter other permission issues between host and container filesystems when you mounted volume to containers. You can add your user to docker user group with the following command.

 

$ sudo usermod -aG docker ${USER}

 

You should logout and login the host again, after called the command.

 $ showmount -e 172.17.0.2

clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)

解决方法:

被访问的NFS服务器上的防火墙没有添加规则,向iptables里面添加查看的所有端口即可(也可以关闭防火墙,不过这样是比较不安全的)

查看端口命令:

$ rpcinfo -p localhost

$ mount -t nfs 172.17.0.2:/data /data -o proto=tcp -o nolock

mount.nfs: Operation not permitted

解决方法:

docker容器启动的时候需要加上–privileged参数,否则启动nfs服务时候会提示权限不足报错。主要是这个过程中涉及到了mount操作, 使用该参数后使得container内的root拥有真正的root权限。

相关推荐