Docker,  技术

Docker Daemon doesn’t listen on 2375 in Ubuntu

By default, it’s using Unit Socket. We need to use TCP.

Update the docker config service to add TCP:

nano /lib/systemd/system/docker.service

ExecStart=/usr/bin/dockerd -H tcp://192.l68.103.98:2375 -H tcp://127.0.0.1:2375

Somehow if we don’t add the real IP I still cannot access it through remote host but only through localhost

Reload Daemon:

systemctl daemon-reload

Restart Docker:

systemctl restart docker

Verify:

ps -aux | grep dockerd

root 1575160 4.9 0.1 2710596 88768 ? Ssl 15:08 0:01 /usr/bin/dockerd -H tcp://127.0.0.1:2375 -H fd:// –containerd=/run/containerd/containerd.sock

sudo netstat -lntp | grep dockerd

tcp 0 0 192.168.103.98:2375 0.0.0.0:* LISTEN 1577963/dockerd

Notes:

I got this error:

ERROR: for redis Cannot start service redis: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:385: applying cgroup configuration for process caused: error while starting unit “docker-ff0191bcee5eeb3eb0b7d80df55e753248db6494d0110a158b7809078fc062f0.scope” with properties [{Name:Description Value:”libcontainer container ff0191bcee5eeb3eb0b7d80df55e753248db6494d0110a158b7809078fc062f0″} {Name:Slice Value:”/docker_limit.slice”} {Name:PIDs Value:@au [1710453]} {Name:Delegate Value:true} {Name:MemoryAccounting Value:true} {Name:CPUAccounting Value:true} {Name:IOAccounting Value:true} {Name:TasksAccounting Value:true} {Name:DefaultDependencies Value:false}]: Invalid unit name ‘/docker_limit.slice’: unknown

Somehow, after upgrading to latest ubuntu, following config doesn’t work:

cat /etc/docker/daemon.json
{
"cgroup-parent": "/docker_limit.slice"
}

I have to remove the slice config.

Leave a Reply

Your email address will not be published. Required fields are marked *