docker is not running as rootless - docker

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 *

Related

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

Intellij Idea: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Even though my user is on docker group and I can launch docker without sudo, and I'm running idea.sh from my user, whenever I try to connect to docker from within Intellij Idea docker plugin, I get
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I'm trying the Unix socket method. I already tried multiple restarts and logout.
I'm on Ubuntu 20.04 and Intellijd Idea 2020.3
Adding current user to docker group worked for me:
sudo gpasswd -a ${USER} docker
You might need to create group first:
sudo groupadd docker
restart your OS after those changes
For me it work
sudo chmod 0777 /var/run/docker.sock
Then test this in the terminal without the sudo
docker ps -a
normally you should have access to the docker process

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 create network on WSL

I am using windows WSL. Have started a docker on windows and exposed the port for WSL using option Expose daemon on tcp://localhost:2375 without TLS
in .bashrc
export DOCKER_HOST=tcp://localhost:2375
My all other docker commands are working fine. But when I try to create a network it fails
sudo docker network create mynetwork
with error
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
During installing of docker etc. I followed a tutorial which gives sudo access for docker.
sudo usermod -aG docker $USER
so sudoing again is not working. Without sudo the command is working good.
docker network create mynetwork

jenkins cant connect Daemon

I am running a jenkins docker application (https://hub.docker.com/r/jenkinsci/blueocean/)
I am trying to do a docker run on jenkins but received this error:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I tried doing : sudo usermod -aG docker jenkins but it said that jenkins user does not exist. I tried doing add admin also but it said it does not exists also.
What am i doing wrong?
I presume that docker service is up & running, if not verify it by running below command -
$ sudo systemctl status docker.service
Run below command to make it work -
$ sudo usermod -aG docker $USER
Log out/in to activate the changes to groups
Explanation -
Change user jenkins with the username which you are logged in on your host -
$ sudo usermod -aG docker $USER
Do a echo $USER to view your current user.
Log out/in to activate the changes to groups, then you can do a docker run ..... successfully.
Note - Jenkins user exists inside the docker container & not on your host machine.
Ref - https://docs.docker.com/install/linux/linux-postinstall/
Check below settings,
The user with which you are running docker run command might not be able to connect with docker, so in that case you need to do
usermod -aG docker <username>
After this, logout from current session, and login again.
Check your docker service
systemctl status docker.service
If not running,
systemctl start docker.service

Resources