4

How do I simply pull and run hello-world?

nicholas@mordor:~$ 
nicholas@mordor:~$ 
nicholas@mordor:~$ snap list docker
Name    Version   Rev   Tracking       Publisher   Notes
docker  20.10.14  1779  latest/stable  canonical✓  -
nicholas@mordor:~$ 
nicholas@mordor:~$ sudo docker pull hello-world
Using default tag: latest
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
nicholas@mordor:~$ 
nicholas@mordor:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:    22.04
Codename:   jammy
nicholas@mordor:~$ 
nicholas@mordor:~$ sudo systemctl start docker
Failed to start docker.service: Unit docker.service not found.
nicholas@mordor:~$ 
nicholas@mordor:~$ sudo systemctl status docker
Unit docker.service could not be found.
nicholas@mordor:~$ 

see also:

https://stackoverflow.com/questions/44678725/cannot-connect-to-the-docker-daemon-at-unix-var-run-docker-sock-is-the-docker

Unit docker.service could not be found

3
  • What does systemctl docker status show?
    – WMRamadan
    Commented Sep 1, 2022 at 23:02
  • service not found @WMRamadan Commented Sep 1, 2022 at 23:03
  • 1
    I would recommend installing docker with apt and not as a snap. The snap version has somewhat limited functionality compared to the apt version. Commented Oct 28, 2022 at 15:16

4 Answers 4

5

In my case, to remedy the "Unit docker.service could not be found" issue, I needed to run...

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

(Source: https://docs.docker.com/engine/install/ubuntu/)

1
  • I'm not sure what that does, but it worked!
    – ShrapNull
    Commented Jun 22, 2023 at 10:14
3

For my case, after install Docker Desktop from .deb file, I ran

sudo apt-get install docker-ce

after that, I tried to run the service

systemctl start docker

and it works! Peviously after I ran sudo apt --fix-broken install when failed to install docker .deb file, it didn't mention the docker-ce is needed. And found out that docker-ce is needed later.

1

It might be that the snap version of docker is just the docker client, and not the actual docker daemon and service. I recommend going to their site and trying to install it using their instructions as it'll likely have the full package

Instructions here for Ubuntu

1

This option helped me: 1. for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done 2. sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc

echo
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

3. sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .