Why running docker-compose on ubuntu I got Permission denied error?

I have installed fresh kubuntu 22.04 on my laptop and when I try to install docker
I have installed docker-ce and docker-compose :

root@serge-at-home:/mnt/_work_sdb8/wwwroot/lar/MngProducts# dpkg -s   docker-compose
Package: docker-compose
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 498
Maintainer: Ubuntu Developers <[email protected]>
Architecture: all
Version: 1.29.2-1
Depends: python3-cached-property (>= 1.2.0) | python3 (>> 3.8), python3-distro (>= 1.5.0), python3-docker (>= 5), python3-dockerpty (>= 0.4.1), python3-docopt (>= 0.6.1), python3-dotenv (>= 0.13.0), python3-jsonschema, python3-requests (>= 2.20.0), python3-texttable (>= 0.9.0), python3-websocket (>= 0.32.0), python3-yaml (>= 3.10), python3:any, python3-distutils
Recommends: docker.io (>= 1.9.0)
Description: define and run multi-container Docker applications with YAML
docker-compose is a service management software built on top of docker. Define
your services and their relationships in a simple YAML file, and let compose
handle the rest.
Original-Maintainer: Docker Compose Team <[email protected]>
Homepage: https://docs.docker.com/compose/
root@serge-at-home:/mnt/_work_sdb8/wwwroot/lar/MngProducts# dpkg -s   docker-ce
Package: docker-ce
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 94347
Maintainer: Docker <[email protected]>
Architecture: amd64
Version: 5:24.0.6-1~ubuntu.22.04~jammy
Replaces: docker-engine
Depends: containerd.io (>= 1.6.4), docker-ce-cli, iptables, libseccomp2 (>= 2.3.0), libc6 (>= 2.34), libdevmapper1.02.1 (>= 2:1.02.97), libsystemd0
Recommends: apparmor, ca-certificates, docker-ce-rootless-extras, git, libltdl7, pigz, procps, xz-utils
Suggests: aufs-tools, cgroupfs-mount | cgroup-lite
Conflicts: docker (<< 1.5~), docker-engine, docker-engine-cs, docker.io, lxc-docker, lxc-docker-virtual-package
Conffiles:
/etc/default/docker 01f06689327cb8ded58332709d28670c
/etc/init.d/docker 4cd80dac70f6019cb5a9c36c38f2e8d2
Description: Docker: the open-source application container engine
Docker is a product for you to build, ship and run any application as a
lightweight container
.
Docker containers are both hardware-agnostic and platform-agnostic. This means
they can run anywhere, from your laptop to the largest cloud compute instance and
everything in between - and they don't require you to use a particular
language, framework or packaging system. That makes them great building blocks
for deploying and scaling web apps, databases, and backend services without
depending on a particular stack or provider.
Homepage: https://www.docker.com

root@serge-at-home:/mnt/_work_sdb8/wwwroot/lar/MngProducts# uname -a
Linux serge-at-home 6.2.0-34-generic #34~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep  7 13:12:03 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

I have run command :

sudo chmod +x /usr/bin/docker-compose

without errors.
But running docker on my project I got “Permission denied” error anyway

serge@serge-at-home:/_wwwroot/lar/FilamentBanners/__DOCKER$ docker-compose up -d --build
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.10/http/client.py", line 1283, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.10/http/client.py", line 1329, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.10/http/client.py", line 1278, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.10/http/client.py", line 1038, in _send_output
self.send(msg)
File "/usr/lib/python3.10/http/client.py", line 976, in send
self.connect()
File "/usr/lib/python3/dist-packages/docker/transport/unixconn.py", line 30, in connect
sock.connect(self.unix_socket)
PermissionError: [Errno 13] Permission denied

What did I miss during installation ?

  • 2

    Did you add your user to the right group? Not a programming question; voting to close as off-topic.

    – 

  • I runn commands usermod -aG docker $USER and newgrp – docker But still got error. which commands do you mean?

    – 

Leave a Comment