sektornba
(Sektornba)
February 2, 2023, 9:39pm
1
Hello,
Can anyone help me please?
My docker is not creating /var/run/docker.sock.
Check this out:
root@vmi414881:/var/run# systemctl start docker
root@vmi414881:/var/run# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
root@vmi414881:/var/run# ls
crond.pid crond.reboot dbus docker docker.pid reboot-required reboot-required.pkgs unattended-upgrades.lock
root@vmi414881:/var/run# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2023-02-02 22:30:54 CET; 3min 10s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 7228 (dockerd)
Tasks: 9
Memory: 25.1M
CGroup: /system.slice/docker.service
└─7228 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Feb 02 22:30:54 myhost.net dockerd[7228]: time="2023-02-02T22:30:54.545882493+01:00" level=info msg="[graphdriver] using prior storage driver: >
Feb 02 22:30:54 myhost.net dockerd[7228]: time="2023-02-02T22:30:54.551094103+01:00" level=info msg="Loading containers: start."
Feb 02 22:30:54 myhost.net dockerd[7228]: time="2023-02-02T22:30:54.683029078+01:00" level=info msg="Default bridge (docker0) is assigned with >
Feb 02 22:30:54 myhost.net dockerd[7228]: time="2023-02-02T22:30:54.736896742+01:00" level=info msg="Loading containers: done."
Feb 02 22:30:54 myhost.net dockerd[7228]: time="2023-02-02T22:30:54.760438742+01:00" level=warning msg="WARNING: No swap limit support"
Feb 02 22:30:54 myhost.net dockerd[7228]: time="2023-02-02T22:30:54.760505854+01:00" level=info msg="Docker daemon" commit=d7573ab graphdriver=>
Feb 02 22:30:54 myhost.net dockerd[7228]: time="2023-02-02T22:30:54.760604471+01:00" level=info msg="Daemon has completed initialization"
Feb 02 22:30:54 myhost.net dockerd[7228]: time="2023-02-02T22:30:54.784888263+01:00" level=info msg="[core] [Server #7] Server created" module=>
Feb 02 22:30:54 myhost.net systemd[1]: Started Docker Application Container Engine.
Feb 02 22:30:54 myhost.net dockerd[7228]: time="2023-02-02T22:30:54.795888318+01:00" level=info msg="API listen on /run/docker.sock"
sektornba
(Sektornba)
February 2, 2023, 9:43pm
2
I did this:
root@vmi414881:/var/run# ln -s /run/docker.sock docker.sock
root@vmi414881:/var/run# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@vmi414881:/var/run#
root@vmi414881:/run# ls -ls /run/docker.sock
0 srw-rw---- 1 root docker 0 Feb 2 22:30 /run/docker.sock
root@vmi414881:/run#
But now I can’t run it from my devops user (yes, devops is member of docker group):
$ docker ps
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied
$
sektornba
(Sektornba)
February 2, 2023, 9:48pm
3
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
rsouza@vmi414881:~$ sudo docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
The Docker client contacted the Docker daemon.
The Docker daemon pulled the “hello-world” image from the Docker Hub.
(amd64)
The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
Overview | Docker Documentation
$
rimelek
(Ákos Takács)
February 2, 2023, 10:21pm
4
On Ubuntu 20.04 /var/run
is a symbolic link to /run
so normally /var/run/docker.sock
would be the same file as /run/docker.sock
.
I moved from contabo to a new provider, but as far as I remember it wasn’t different on their servers. The best way would be if you could make /var/run
a symbolic link again to /var/run
. Otherwise it is possible that your symbolic link is still owned by root as you created it as root…
sektornba
(Sektornba)
February 2, 2023, 10:52pm
5
Thanks for your reply. Yes, it’s at contabo. Did you know that because vmi ?
I am lost about this issue.
If is already an ln. Why it’s not working here?
rimelek
(Ákos Takács)
February 2, 2023, 10:58pm
6
The domain name literally contains “contaboserver”. It wasn’T hard to find out
“ln” is the command not for symbolic links only. I am not sue what you mean. Please, show the output of
ls -l /var | grep run
Since /run
and /var/run
was different on your vps, it /var/run
can’t be a symbolic link, but it should be.
sektornba
(Sektornba)
February 2, 2023, 11:01pm
7
rimelek:
ls -l /var | grep run
root@vmi414881:~# ls -l /var | grep run
drwx------ 4 root root 4096 Feb 2 23:33 run
root@vmi414881:~#
rimelek
(Ákos Takács)
February 2, 2023, 11:11pm
8
This is not a symbolic link.Now how many files do you have in that folder?
ls /var/run | wc -l
sektornba
(Sektornba)
February 2, 2023, 11:41pm
9
rimelek:
ls /var/run | wc -l
root@vmi414881:~# ls /var/run | wc -l
8
root@vmi414881:~# ls /var/run
crond.pid crond.reboot dbus docker docker.pid reboot-required reboot-required.pkgs unattended-upgrades.lock
root@vmi414881:~# ls
sektornba
(Sektornba)
February 3, 2023, 3:36am
10
Hello. I followed this post and it seems working.
I am testing a pipeline right now.
Thanks @rimelek
rimelek
(Ákos Takács)
February 3, 2023, 6:30pm
11
sektornba:
followed this post
Which post? Did you forget to share the link?
sektornba
(Sektornba)
February 3, 2023, 9:55pm
12
1 Like