Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-py : PermissionError(13)

While I was running

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

I encountered the following error

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

I think it is because docker-py is not able to get access of the docker daemon. So how do I fix this?

like image 519
Shubham Pandey Avatar asked Jan 26 '23 01:01

Shubham Pandey


1 Answers

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

Create Group

sudo groupadd docker

Attach User to Group

sudo usermod -aG docker $USER

Reload

su -s ${USER}
like image 96
Tigran Avatar answered Jan 28 '23 12:01

Tigran