Cannot connect to the Docker daemon. Manjaro - docker

everyone!
i installed docker, docker-compose, then executed next commands:
`
sudo systemctl start docker.service
sudo systemctl status docker.service
sudo systemctl enable docker.service
sudo usermod -aG docker $USER
docker run hello-world`
OS: Manjaro, Archlinux
error: Server:
ERROR: Cannot connect to the Docker daemon at unix:. Is the docker daemon running?
ALREADY TRY A LOT!! Daemon won't start!

Try export DOCKER_HOST=unix:///var/run/docker.sock, then run docker run hello-world again.

Related

docker is not running as rootless

i had install docker on arch Manjaro
had try
sudo usermod -aG docker $USER
it is added to the user
id arch
uid=1000(arch) gid=1001(arch) groups=1001(arch),998(wheel),991(lp),3(sys),90(network),98(power),1000(autologin),962(docker)
docker ps
Cannot connect to the Docker daemon at unix:///home/arch/.docker/desktop/docker.sock. Is the docker daemon running?
*i have to edit a file that present in docker but iam not able to *

how can i made docker work with my user (ubuntu)

this is the current situation:
hamsterofdeath#HodVm:~$ docker ps
Cannot connect to the Docker daemon at unix:///home/hamsterofdeath/.docker/desktop/docker.sock. Is the docker daemon running?
hamsterofdeath#HodVm:~$ sudo docker ps
[sudo] password for hamsterofdeath:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
hamsterofdeath#HodVm:~$ docker ps
Cannot connect to the Docker daemon at unix:///home/hamsterofdeath/.docker/desktop/docker.sock. Is the docker daemon running?
hamsterofdeath#HodVm:~$ sudo groupadd docker
groupadd: group 'docker' already exists
hamsterofdeath#HodVm:~$ sudo gpasswd -a ${USER} docker
Adding user hamsterofdeath to group docker
hamsterofdeath#HodVm:~$ docker ps
Cannot connect to the Docker daemon at unix:///home/hamsterofdeath/.docker/desktop/docker.sock. Is the docker daemon running?
hamsterofdeath#HodVm:~$
cat /etc/group gives me "docker:x:996:hamsterofdeath"
logging out and in again changes nothing. i also tried:
sudo usermod -aG docker $USER
sudo usermod -a -G docker $USER
but it has no effect. what do i need to do?
i always get:
Cannot connect to the Docker daemon at unix:///home/hamsterofdeath/.docker/desktop/docker.sock. Is the docker daemon running?
or
Error response from daemon: dial unix /home/hamsterofdeath/.docker/desktop/docker.raw.sock: connect: connection refused
with sudo, it works
there might be another(?) problem
i removed docker via
sudo apt remove docker
but the "docker" command still exists.
amsterofdeath#HodVm:~$ sudo apt remove docker
[sudo] password for hamsterofdeath:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'docker' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
hamsterofdeath#HodVm:~$ docker ps
Cannot connect to the Docker daemon at unix:///home/hamsterofdeath/.docker/desktop/docker.sock. Is the docker daemon running?
hamsterofdeath#HodVm:~$
Waht you could try:
Try restarting the bash process and probably the machine.
See if the docker group is associated with the .sock file
This should return nothing:
stat -c %U:%G /home/hamsterofdeath/.docker/desktop/docker.raw.sock | grep -v root:docker
if it does do:
chown root:docker /home/hamsterofdeath/.docker/desktop/docker.raw.sock
Is $USER filled with the correct data ?
Restart docker engine using sudo systemctl
Else go to Post-Install and try all the steps there especially since it seems to an VM restart it
Next Docker Desktop is rather sketchy. I personally recommend using the VS-Code Docker extension as it offers almost the same functionality as docker desktop and works fine with Ubuntu. See Docker Extension VS-Code

Problems starting docker instance

Not sure this is a docker problem specifically but this is how it goes: I tried sudo docker stop 7f8c9285465c which resulted in
Error response from daemon: cannot stop container: 7f8c9285465c: Cannot kill container...unknown error after kill: runc did not terminate sucessfully: container_linux.go:392: signaling init process caused "permission denied"
Following this stackoverflow suggestion I did sudo aa-remove-unknown. Now the docker stop succeeded but subsequent docker-compose up resulted in:
snap-confine has elevated permissions and is not confined but should be. Refusing to continue to avoid permission escalation attacks.
Next I ran the command sudo apt purge snapd snap-confine && sudo apt install -y snapd. Now running docker-compose up results in
bash: /snap/bin/docker-compose: No such file or directory.
The command sudo docker container ls results in:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
sudo service docker status returns Active: active (running).
I tried reinstalling docker. running sudo docker run hello-world retunrs the same Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (although status is active)
.
Create file /etc/systemd/network/bridge.network with contents:
[Network]
IPFoward=kernel
If no permissions to save do so in root mode (sudo su -).
Then, run:
sudo systemctl restart systemd-networkd.service # (disconnected network)
sudo apt remove docker-ce # If you hadn't done so before
sudo apt install docker-ce # Should start docker.service
sudo systemctl status docker.service # Verify docker.service is running
This information has been taken from this docker forum discussion.
I think you installed docker with snap and installation of snapd is not complete "snap-confine has elevated permissions and is not confined but should be. Refusing to continue to avoid permission escalation attacks.
" this error indicates that "apparmor" service is not enabled.
sudo systemctl enable --now apparmor
sudo systemctl status apparmor
If apparmor is not installed install it:
sudo apt-get install apparmor
this error "bash: /snap/bin/docker-compose" indicates that "/snap/bin" is not in your PATH. if you run this snap --version you might get an error saying "/snap/bin" is not in PATH.
sudo nano /etc/environment
Add "/snap/bin"
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/snap/bin
Now you need to restart your system. Everything should be fixed.

Unable to sudo docker pull ubuntu from windows-ubuntu

syed#DESKTOP-E396P7V:~$ sudo systemctl status ssh
Failed to connect to bus: No such file or directory
syed#DESKTOP-E396P7V:~$ sudo docker pull ubuntu
Using default tag: latest
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
syed#DESKTOP-E396P7V:~$ sudo docker.io pull ubuntu
sudo: docker.io: command not found
syed#DESKTOP-E396P7V:~$
Your docker daemon is not running, run it by executing sudo systemctl start docker

Docker service doesn't start after boot

I am trying to figure out why my docker service doesn't run automatically on reboot.
Here it is:
$ sudo cat /etc/systemd/system/docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --insecure-registry=some-registry
When I try:
$ sudo systemctl enable docker.service
nothing happens.
The status of this service under list-unit-files:
$ sudo systemctl list-unit-files | grep docker
docker.service static
If I start the service manually (sudo systemctl start docker.service) it works as expected though.
Any ideas why?
The issue is because you have not specified any target in your service. You should change the service file as below
$ sudo cat /etc/systemd/system/docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --insecure-registry=some-registry
[Install]
WantedBy=multi-user.target
After that run the below commands
systemctl daemon-reload
systemctl disable docker
systemctl enable docker
And restart the system

Resources