docker-py:PermissionError(13)

我跑步时

>>> import docker
>>> client = docker.from_env()
>>> client.containers.list()

我遇到以下错误

requests.exceptions.ConnectionError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

我认为这是因为docker-py无法访问docker守护程序。那么我该如何解决呢?

评论
说不出口的爱
说不出口的爱

According to Docker docs you should create a group and attach your user to that group.

创建组

sudo groupadd docker

将用户附加到组

sudo usermod -aG docker $USER

重装

su -s ${USER}
点赞
评论