Python Docker client is not able to find Docker daemon

452 Views Asked by At

I am working on an ubuntu/windows dual booted system, with the following specifications --> system-specs

And, my Python version is 3.9.7

So, I am trying to run the following python program using Jina AI : simple-jina-examples/basics/2_executor_options. But, I am continuously getting stuck. The program, while executing keeps showing the following output -->

euhid@euhid-Inspiron-3576:~/Desktop/python_projects/simple-jina-examples/basics/2_executor_options$ python app.py 
    indexer@12691[C]:Docker daemon seems not running. Please run Docker daemon and try again.
    encoder@12691[W]:Pea is being closed before being ready. Most likely some other Pea in the Flow or Pod failed to start
Collecting en-core-web-md==3.1.0
  Using cached https://github.com/explosion/spacy-models/releases/download/en_core_web_md-3.1.0/en_core_web_md-3.1.0-py3-none-any.whl (45.4 MB)
Requirement already satisfied: spacy<3.2.0,>=3.1.0 in /home/euhid/Desktop/python_projects/jina-venv/lib/python3.9/site-packages (from en-core-web-md==3.1.0) (3.1.2)

Now, I already have docker installed and running on my computer too. Because, when I do systemctl status docker, I get the following output -->

● docker.service - Docker Application Container Engine
 Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
 Active: active (running) since Sun 2021-12-19 10:44:24 IST; 20s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 14868 (dockerd)
      Tasks: 21
     Memory: 60.6M
        CPU: 860ms
     CGroup: /system.slice/docker.service
             └─14868 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Dec 19 10:44:21 euhid-Inspiron-3576 dockerd[14868]: time="2021-12-19T10:44:21.733734909+05:30" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/conta>
Dec 19 10:44:21 euhid-Inspiron-3576 dockerd[14868]: time="2021-12-19T10:44:21.733748034+05:30" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Dec 19 10:44:22 euhid-Inspiron-3576 dockerd[14868]: time="2021-12-19T10:44:22.315221221+05:30" level=info msg="[graphdriver] using prior storage driver: overlay2"
Dec 19 10:44:22 euhid-Inspiron-3576 dockerd[14868]: time="2021-12-19T10:44:22.545319612+05:30" level=info msg="Loading containers: start."

And to troubleshoot the issue, I have already tried stopping and starting docker with the commands systemctl stop docker and systemctl start docker. I have also tried uninstalling and installing docker again.

So, I would like for a way to resolve the above issue, so that the program executes properly. And, I believe that this is happening because my Python Docker client is not able to find the Docker daemon.

If anyone has a way to fix this, with proper and simple explanation. Then it would be very helpful for me.

As I am a beginner, so I would really appreciate it, if the answer can be provided in a beginner-friendly manner too.

1

There are 1 best solutions below

0
On

Well, this had a very simple answer. So, basically I was present in the sudo group, and not in the docker group. And, after adding my user to the docker group, I was able to fix the above issue.

To add an user to a group, one can refer to the direct documentation itself at --> https://docs.docker.com/engine/install/linux-postinstall/