jstarks / npiperelay

npiperelay allows you to access Windows named pipes from WSL
MIT License
660 stars 71 forks source link

Cannot connect to Docker deamon: how to debug? #8

Closed Ravenwater closed 5 years ago

Ravenwater commented 5 years ago

Running into the following failure:

stillwater@sw-desktop-300:~$ sudo ./docker-relay &
[1] 41
stillwater@sw-desktop-300:~$ docker images
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

[1]+  Stopped                 sudo ./docker-relay

From a PS, confirmed that the docker deamon is running

PS C:\Users\tomtz> docker info
Client:
 Debug Mode: false

Server:
 Containers: 36
  Running: 36
  Paused: 0
  Stopped: 0
 Images: 26
 Server Version: 19.03.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 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
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.9.184-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.63GiB
 Name: docker-desktop
 ID: 7TG2:NXNU:DPH4:PK2T:OKQT:6AZC:DCNM:NVH5:QHY6:3I7Y:QPBL:XQXR
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 126
  Goroutines: 119
  System Time: 2019-09-07T14:10:57.2339252Z
  EventsListeners: 1
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

So, how do I debug what is failing?

Ravenwater commented 5 years ago

turned out to be incorrect permissions on my docker-relay.

coip commented 4 years ago

for anyone running into a similar issue, job management is useful here:

dont specify background($ at the end) when invoking sudo ... if your auth isn't cached; instead use CTRL+Z to suspend your job, and bg to run the most-recently-suspended job in the background.

eg: (the ^Z below is when CTRL+Z is entered, after entering the password for sudo ...)

ethan@coip:~$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

ethan@coip:~$ ./docker-relay
2020/01/13 15:21:43 socat[281] E bind(5, {AF=1 "/var/run/docker.sock"}, 22): Permission denied

ethan@coip:~$ sudo !!
sudo ./docker-relay
[sudo] password for ethan:
^Z
[1]+  Stopped                 sudo ./docker-relay

ethan@coip:~$ bg
[1]+ sudo ./docker-relay &

ethan@coip:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

ethan@coip:~$