Handful of things im tring to fix

Thank you for the reply on the format and thank you in advance for the help!

Basic stuff:
ubuntu 22.04.2 LTS
Host: win10 PRO

root@rossroxas-883:/# docker info
 Client: Docker Engine - Community
 Version:    24.0.6
 Context:    default
 Debug Mode: false
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
root@rossroxas-883:/# docker version
 Client: Docker Engine - Community
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:31:44 2023
 OS/Arch:           linux/amd64
 Context:           default
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.24
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version:
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.15.90.1-microsoft-standard-WSL2
 Operating System: Ubuntu Core 22
 OSType: linux
 Architecture: x86_64
 CPUs: 20
 Total Memory: 15.47GiB
 Name: rossroxas-883
 ID: 6WDD:5FIP:XZRX:WLU2:SVK4:BPBB:MCHW:F63R:5NCN:QTGJ:K5QW:LT6O
 Docker Root Dir: /var/snap/docker/common/var-lib-docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
sudo dockerd -H unix:///var/run/docker.sock -H tcp://192.168.59.106 -H tcp://10.10.10.2
unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character '}' looking for beginning of object key string```
docker -H tcp://0.0.0.0:2375 ps
Cannot connect to the Docker daemon at tcp://0.0.0.0:2375.

i tried to create a docker.sock but the docker.sock.raw keeps overriding as default

editing the docker.sock, its not saving or im not configurating it correctly.

failing for “hello world” and I got tired

Please format your post by wrapping three backticks ``` before and after commands and output.

Furthermore, please share the content of /etc/docker/daemon.json.

root@rossroxas-883:/# cat /etc/docker/daemon.json

{
  "allow-nondistributable-artifacts": [],
  "api-cors-header": "",
  "authorization-plugins": [],
  "bip": "172.26.0.1/16",
  "bridge": "",
  "cgroup-parent": "",
  "containerd": "/run/containerd/containerd.sock",
  "containerd-namespace": "docker",
  "containerd-plugin-namespace": "docker-plugins",
  "data-root": "",
  "debug": true,
  "default-address-pools": [
    {
      "base": "172.30.0.0/16",
      "size": 24
    },
    {
      "base": "172.31.0.0/16",
      "size": 24
    }
  ],
  "default-cgroupns-mode": "private",
  "default-gateway": "",
  "default-gateway-v6": "",
  "default-runtime": "runc",
  "default-shm-size": "64M",
  "default-ulimits": {
    "nofile": {
      "Hard": 64000,
      "Name": "nofile",
      "Soft": 64000
    }
  },
  "dns": [],
  "dns-opts": [],
  "dns-search": [],
  "exec-opts": [],
  "exec-root": "",
  "experimental": false,
  "features": {},
  "fixed-cidr": "",
  "fixed-cidr-v6": "",
  "group": "",
  "hosts": [],
  "proxies": {
    "http-proxy": "http://proxy.example.com:80",
    "https-proxy": "https://proxy.example.com:443",
    "no-proxy": "*.test.example.com,.example.org",
  },
  "icc": false,
  "init": false,
  "init-path": "/usr/libexec/docker-init",
  "insecure-registries": [],
  "ip": "0.0.0.0",
  "ip-forward": false,
  "ip-masq": false,
  "iptables": false,
  "ip6tables": false,
  "ipv6": false,
  "labels": [],
  "live-restore": true,
  "log-driver": "json-file",
  "log-level": "",
  "log-opts": {
    "cache-disabled": "false",
    "cache-max-file": "5",
    "cache-max-size": "20m",
    "cache-compress": "true",
    "env": "os,customer",
    "labels": "somelabel",
    "max-file": "5",
    "max-size": "10m"
  },
  "max-concurrent-downloads": 3,
  "max-concurrent-uploads": 5,
  "max-download-attempts": 5,
  "mtu": 0,
  "no-new-privileges": false,
  "node-generic-resources": [
    "NVIDIA-GPU=UUID1",
    "NVIDIA-GPU=UUID2"
  ],
  "oom-score-adjust": 0,
  "pidfile": "",
  "raw-logs": false,
  "registry-mirrors": [],
  "runtimes": {
    "cc-runtime": {
      "path": "/usr/bin/cc-runtime"
    },
    "custom": {
      "path": "/usr/local/bin/my-runc-replacement",
      "runtimeArgs": [
        "--debug"
      ]
    }
  },
  "seccomp-profile": "",
  "selinux-enabled": false,
  "shutdown-timeout": 15,
  "storage-driver": "",
  "storage-opts": [],
  "swarm-default-advertise-addr": "",
  "tls": true,
  "tlscacert": "",
  "tlscert": "",
  "tlskey": "",
  "tlsverify": true,
  "userland-proxy": false,
  "userland-proxy-path": "/usr/libexec/docker-proxy",
  "userns-remap": ""
}
{
  "proxies": {
    "http-proxy": "http://proxy.example.com:3128",
    "https-proxy": "https://proxy.example.com:3129",
    "no-proxy": "*.test.example.com,.example.org,127.0.0.0/8"
  }
}

Are you sure this is the correct file?

It is not a valid json document. It ~lacks the first {, and~ is not allowed to have more than one surrounding pair of curly brackets on the top level.

Paste you actual config into a validator or linter like this one: https://jsonlint.com
Then fix all the problems it indicates. Apparently you are not using an IDE, otherwise the built-in validator would have highlighted the findings already.

My bad. I was ambiguous: the backticks are supposed to be in the line before and after the content. I fixed it in your post. Please take a look in edit mode how it’s formatted now.

like some, total n00b.

weird, i copied it from the ubuntu terminal

{
  "allow-nondistributable-artifacts": [],
  "api-cors-header": "",
  "authorization-plugins": [],
  "bip": "172.26.0.1/16",
  "bridge": "",
  "cgroup-parent": "",
  "containerd": "/run/containerd/containerd.sock",
  "containerd-namespace": "docker",
  "containerd-plugin-namespace": "docker-plugins",
  "data-root": "",
  "debug": true,
  "default-address-pools": [
    {
      "base": "172.30.0.0/16",
      "size": 24
    },
    {
      "base": "172.31.0.0/16",
      "size": 24
    }
  ],
  "default-cgroupns-mode": "private",
  "default-gateway": "",
  "default-gateway-v6": "",
  "default-runtime": "runc",
  "default-shm-size": "64M",
  "default-ulimits": {
    "nofile": {
      "Hard": 64000,
      "Name": "nofile",
      "Soft": 64000
    }
  },
  "dns": [],
  "dns-opts": [],
  "dns-search": [],
  "exec-opts": [],
  "exec-root": "",
  "experimental": false,
  "features": {},
  "fixed-cidr": "",
  "fixed-cidr-v6": "",
  "group": "",
  "hosts": [],
  "proxies": {
    "http-proxy": "http://proxy.example.com:80",
    "https-proxy": "https://proxy.example.com:443",
    "no-proxy": "*.test.example.com,.example.org",
  },
  "icc": false,
  "init": false,
  "init-path": "/usr/libexec/docker-init",
  "insecure-registries": [],
  "ip": "0.0.0.0",
  "ip-forward": false,
  "ip-masq": false,
  "iptables": false,
  "ip6tables": false,
  "ipv6": false,
  "labels": [],
  "live-restore": true,
  "log-driver": "json-file",
  "log-level": "",
  "log-opts": {
    "cache-disabled": "false",
    "cache-max-file": "5",
    "cache-max-size": "20m",
    "cache-compress": "true",
    "env": "os,customer",
    "labels": "somelabel",
    "max-file": "5",
    "max-size": "10m"
  },
  "max-concurrent-downloads": 3,
  "max-concurrent-uploads": 5,
  "max-download-attempts": 5,
  "mtu": 0,
  "no-new-privileges": false,
  "node-generic-resources": [
    "NVIDIA-GPU=UUID1",
    "NVIDIA-GPU=UUID2"
  ],
  "oom-score-adjust": 0,
  "pidfile": "",
  "raw-logs": false,
  "registry-mirrors": [],
  "runtimes": {
    "cc-runtime": {
      "path": "/usr/bin/cc-runtime"
    },
    "custom": {
      "path": "/usr/local/bin/my-runc-replacement",
      "runtimeArgs": [
        "--debug"
      ]
    }
  },
  "seccomp-profile": "",
  "selinux-enabled": false,
  "shutdown-timeout": 15,
  "storage-driver": "",
  "storage-opts": [],
  "swarm-default-advertise-addr": "",
  "tls": true,
  "tlscacert": "",
  "tlscert": "",
  "tlskey": "",
  "tlsverify": true,
  "userland-proxy": false,
  "userland-proxy-path": "/usr/libexec/docker-proxy",
  "userns-remap": ""
}
{
  "proxies": {
    "http-proxy": "http://proxy.example.com:3128",
    "https-proxy": "https://proxy.example.com:3129",
    "no-proxy": "*.test.example.com,.example.org,127.0.0.0/8"
  }
}```

------------------------------------------
result from the json validator:
```root @rossroxas - 883: /# cat /etc / docker / daemon.json {
	"allow-nondistributable-artifacts": [],
	"api-cors-header": "",
	"authorization-plugins": [],
	"bip": "172.26.0.1/16",
	"bridge": "",
	"cgroup-parent": "",
	"containerd": "/run/containerd/containerd.sock",
	"containerd-namespace": "docker",
	"containerd-plugin-namespace": "docker-plugins",
	"data-root": "",
	"debug": true,
	"default-address-pools": [{
			"base": "172.30.0.0/16",
			"size": 24
		},
		{
			"base": "172.31.0.0/16",
			"size": 24
		}
	],
	"default-cgroupns-mode": "private",
	"default-gateway": "",
	"default-gateway-v6": "",
	"default-runtime": "runc",
	"default-shm-size": "64M",
	"default-ulimits": {
		"nofile": {
			"Hard": 64000,
			"Name": "nofile",
			"Soft": 64000
		}
	},
	"dns": [],
	"dns-opts": [],
	"dns-search": [],
	"exec-opts": [],
	"exec-root": "",
	"experimental": false,
	"features": {},
	"fixed-cidr": "",
	"fixed-cidr-v6": "",
	"group": "",
	"hosts": [],
	"proxies": {
		"http-proxy": "http://proxy.example.com:80",
		"https-proxy": "https://proxy.example.com:443",
		"no-proxy": "*.test.example.com,.example.org",
	},
	"icc": false,
	"init": false,
	"init-path": "/usr/libexec/docker-init",
	"insecure-registries": [],
	"ip": "0.0.0.0",
	"ip-forward": false,
	"ip-masq": false,
	"iptables": false,
	"ip6tables": false,
	"ipv6": false,
	"labels": [],
	"live-restore": true,
	"log-driver": "json-file",
	"log-level": "",
	"log-opts": {
		"cache-disabled": "false",
		"cache-max-file": "5",
		"cache-max-size": "20m",
		"cache-compress": "true",
		"env": "os,customer",
		"labels": "somelabel",
		"max-file": "5",
		"max-size": "10m"
	},
	"max-concurrent-downloads": 3,
	"max-concurrent-uploads": 5,
	"max-download-attempts": 5,
	"mtu": 0,
	"no-new-privileges": false,
	"node-generic-resources": [
		"NVIDIA-GPU=UUID1",
		"NVIDIA-GPU=UUID2"
	],
	"oom-score-adjust": 0,
	"pidfile": "",
	"raw-logs": false,
	"registry-mirrors": [],
	"runtimes": {
		"cc-runtime": {
			"path": "/usr/bin/cc-runtime"
		},
		"custom": {
			"path": "/usr/local/bin/my-runc-replacement",
			"runtimeArgs": [
				"--debug"
			]
		}
	},
	"seccomp-profile": "",
	"selinux-enabled": false,
	"shutdown-timeout": 15,
	"storage-driver": "",
	"storage-opts": [],
	"swarm-default-advertise-addr": "",
	"tls": true,
	"tlscacert": "",
	"tlscert": "",
	"tlskey": "",
	"tlsverify": true,
	"userland-proxy": false,
	"userland-proxy-path": "/usr/libexec/docker-proxy",
	"userns-remap": ""
} {
	"proxies": {
		"http-proxy": "http://proxy.example.com:3128",
		"https-proxy": "https://proxy.example.com:3129",
		"no-proxy": "*.test.example.com,.example.org,127.0.0.0/8"
	}
}
Error: Parse error on line 1:
root @rossroxas - 88
^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined' 

It is still not a valid json document. Like I already wrote, it can not have two top level curly bracket elements. Furthermore, some lines have , at the end where it is not supposed to be. One line has metadata character.

Just copy your stuff into the linter and fix one finding at the time.

I would never add config elements that have the default value to the deamon.json, as it will make it unnecessarily harder in a couple of months to understand which change have actually been necessary.

i did a purge on both docker and docker-ce, then removed the daemon.json.

following that, i re-installed docker-ce and

root@rossroxas-883:~# cat /etc/docker/daemon.json
cat: /etc/docker/daemon.json: No such file or directory

id rather start clean sometimes. what steps should I do next?

This is normal. By default, there is no /etc/docker/daemon.json. It is not required, unless you want to customize default values.

The official docs about daemon configuration can be found here:

thanks for the confirmation. if there a “default” config that i dont need to format and that wont have issues leading to ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock and caused by formatted in unicode and incorrect info in the daemon.json?

Can you rephrase your last response, I am not really sure what you are saying.

On a fresh system, you can install the docker-ce package, and it will simply start using the default values for all configuration elements, without having to configure anything.

Just run sudo docker info and it should work, without throwing errors.

when i run sudo docker info

Client: Docker Engine - Community
 Version:    24.0.6
 Context:    default
 Debug Mode: false
Server:
 Containers: 6
  Running: 0
  Paused: 0
  Stopped: 6
 Images: 8
 Server Version: 24.0.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 nvidia runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
 runc version: v1.1.8-0-g82f18fe
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 5.15.90.1-microsoft-standard-WSL2
 Operating System: Ubuntu 22.04.3 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 20
 Total Memory: 15.47GiB
 Name: rossroxas-883
 ID: bd4b1bce-e490-4278-90b0-a064ea1f9f06
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

nice, no errors!

what would the easiest or consistent fix for

ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock

its been giving me a headache and I was trying to find updated and accurate config info to move past that error.

Where do you get that error?
Please share the exact command, and share the output of id

well, it was usually appearing when I ran docker info or docker version. but now maybe after i removed the files with the purge, reinstalled and then ran the ``docker infoordocker version, no error after sudo systemctl restart docker.service sudo systemctl start docker.service so far hasnt given me theERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock```

i tihnk i tried to fix it so many times vs removing it and doing the purge and re-install helped. I hope i wont run into needing to fix/edit the daemon configs later.

thanks for the knowlwdge!

root@rossroxas-883:/# docker plugin install docker-buildx Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

root@rossroxas-883:/# docker plugin ls Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

my plugins are invalid, i was going to do those last… or right now.

Does it happen if you prefix teh commands with sudo as well?

i am not sure what you try to install, but docker-buildx is a cli plugin, and not a plugin for the docker daemin: GitHub - docker/buildx: Docker CLI plugin for extended build capabilities with BuildKit

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
root@rossroxas-883:/# sudo docker exec plugin install docker-buildx
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?```

only because I saw the plugin errors and ```root@rossroxas-883:/# docker plugin list
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?```.

ok, its weird. Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? goes away after I remove the file and reboot.

Something is not adding up here.

Did you enable systemd support in /etc/wsl.conf or are you starting the docker daemon manually?

I highly recommend enabling systemd support. You should be able to google and find plenty of blog posts about it. This allows the docker service to be started whenever you start the WSL2 distribution.

Furthermore, by default only root is allowed to access the docker.sock, so the docker cli must be used as root. If you want your unprivileged user to be able to access the docker.sock, you need to add the user to the docker group (see post installation instructions in the docs).

Assuming the Docker command was used as root, as @meyay already pointed out, you need systemd or manually starting the Docker daemon. In your first post you ran the dockerd command manually. You don’t actually need that. Although systemd makes it easier to use Docker in a WSL distribution, you can should still be able to start the daemon using the service command:

service docker start