解决:Docker 导入镜像 时遇到的权限问题~!

 Docker 时遇到了权限问题。具体来说,你试图连接到 Docker daemon,但被拒绝了

错误提示:

tianya@tianya-virtual-machine:~/下载$ sudo cat docker/talebook.tar | docker import - test/talebook:v1
[sudo] password for tianya: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/create?fromSrc=-&message=&repo=test%2Ftalebook%3Av1&tag=": dial unix /var/run/docker.sock: connect: permission denied

加入 docker 用户组中

sudo usermod -aG docker $USER

修改权限:

tianya@tianya-virtual-machine:~/下载$ ls -l /var/run/docker.sock
srw-rw---- 1 root docker 0  1月  3 15:46 /var/run/docker.sock
tianya@tianya-virtual-machine:~/下载$ sudo chmod 666 /var/run/docker.sock
tianya@tianya-virtual-machine:~/下载$ sudo cat docker/talebook.tar | docker import - test/talebook:v1
cat: docker/talebook.tar: No such file or directory
sha256:69b444e63a043ba49f608471da05a0ad00216547d6137a2da73030d4853dc18a
tianya@tianya-virtual-machine:~/下载$ docker images
REPOSITORY      TAG       IMAGE ID       CREATED          SIZE
test/talebook   v1        69b444e63a04   20 seconds ago   0B

你可能感兴趣的:(docker,容器,运维)