Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Not Detected #553

Open
Praexor opened this issue May 3, 2022 · 31 comments
Open

Docker Not Detected #553

Praexor opened this issue May 3, 2022 · 31 comments
Labels
bug Something isn't working up for grabs Anyone can work on this

Comments

@Praexor
Copy link

Praexor commented May 3, 2022

"Docker Not Detected" but I have it and running ubuntu 20 installation, nevertheless detect docker-compose, please help!

@antonilol
Copy link

i get "Docker Not Detected" when i did not systemctl start docker yet, after i start docker and click try again it works

@jamaljsr
Copy link
Owner

jamaljsr commented May 4, 2022

There should be a log file located at ~/.polar/logs/renderer.log. Can you send the few lines proceeding the message

[2022-05-04 00:44:08.003] [debug] fetching docker version
...
[2022-05-04 00:44:08.084] [debug] getting docker-compose version
...

@antonilol
Copy link

[2022-05-03 20:08:47.732] [debug] fetching docker version
[2022-05-03 20:08:47.738] [debug] Failed: connect ENOENT /var/run/docker.sock
[2022-05-03 20:08:47.738] [debug] getting docker-compose version
[2022-05-03 20:08:47.741] [debug] env: uid=1000 gid=1000
[2022-05-03 20:08:47.790] [debug] Result: {"exitCode":0,"err":"","out":"2.4.1\n","data":{"version":"2.4.1"}}
[2022-05-03 20:08:47.795] [debug] fetching docker images
[2022-05-03 20:08:47.798] [debug] Failed: connect ENOENT /var/run/docker.sock
[2022-05-03 20:09:00.610] [debug] fetching docker version
[2022-05-03 20:09:00.625] [debug] Result: {"Platform":{"Name":""},"Components":[{"Name":"Engine","Version":"20.10.14","Details":{"ApiVersion":"1.41","Arch":"amd64","BuildTime":"2022-03-24T08:56:03.000000000+00:00","Experimental":"false","GitCommit":"87a90dc786","GoVersion":"go1.18","KernelVersion":"5.17.2-arch3-1","MinAPIVersion":"1.12","Os":"linux"}},{"Name":"containerd","Version":"v1.6.2","Details":{"GitCommit":"de8046a5501db9e0e478e1c10cbcfb21af4c6b2d.m"}},{"Name":"runc","Version":"1.1.1","Details":{"GitCommit":""}},{"Name":"docker-init","Version":"0.19.0","Details":{"GitCommit":"de40ad0"}}],"Version":"20.10.14","ApiVersion":"1.41","MinAPIVersion":"1.12","GitCommit":"87a90dc786","GoVersion":"go1.18","Os":"linux","Arch":"amd64","KernelVersion":"5.17.2-arch3-1","BuildTime":"2022-03-24T08:56:03.000000000+00:00"}
[2022-05-03 20:09:00.626] [debug] getting docker-compose version
[2022-05-03 20:09:00.629] [debug] env: uid=1000 gid=1000
[2022-05-03 20:09:00.641] [debug] Result: {"exitCode":0,"err":"","out":"2.4.1\n","data":{"version":"2.4.1"}}
[2022-05-03 20:09:03.120] [debug] The network 'test1' is missing docker images [ 'polarlightning/bitcoind:0.21.1', 'polarlightning/lnd:0.12.1-beta' ]
[2022-05-03 20:09:03.151] [info]  Rendering NetworkView component
[2022-05-03 20:09:03.223] [info]  saved networks to '/home/antoni/.polar/networks/networks.json'

@antonilol
Copy link

this socket file is exists when docker runs

$ ls /var/run/docker.sock -la
ls: cannot access '/var/run/docker.sock': No such file or directory
$ sudo systemctl start docker
$ ls /var/run/docker.sock -la
srw-rw---- 1 root docker 0 May  4 10:36 /var/run/docker.sock

@jamaljsr
Copy link
Owner

jamaljsr commented May 4, 2022

This may be a permissions issue. Are you able to run docker version in the Terminal without sudo?

Also see the linux post-install steps
https://docs.docker.com/engine/install/linux-postinstall/

@antonilol
Copy link

Yes, but i have to start it with sudo (i can also systemctl enable it but i dont want it to start on boot)

@jamaljsr
Copy link
Owner

jamaljsr commented May 4, 2022

Can you temporary test running Polar as sudo just to confirm that it's a permissions issue?

@antonilol
Copy link

$ sudo /opt/Polar/polar 
[sudo] password for antoni: 
[67718:0504/221109.535241:FATAL:electron_main_delegate.cc(253)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
Trace/breakpoint trap

electron doesnt run as root...

my polar just works normally if i systemctl start docker, as you can see the permissions are rw- for group docker, which i am in, so i have write and read access to that socker without root

@jamaljsr
Copy link
Owner

jamaljsr commented May 6, 2022

Sadly, my Ubuntu VM won't boot up so I can't troubleshoot your scenario in my own environment. I could be wrong, but I suspect the root cause is related to docker permissions and not something that can be solved by a change in Polar.

I'll leave this issue open in case others run into the same problem or would like to suggest potential solutions.

@jamaljsr jamaljsr added the bug Something isn't working label May 6, 2022
@antonilol
Copy link

I would suggest you first check if docker is installed (check if /usr/bin/docker exists), then check if it is running. what now says 'docker not found' actually is 'no running docker found'

@riccardobl
Copy link

riccardobl commented May 27, 2022

Same issue here, on ubuntu 20.04 and docker desktop.
Docker commands work for the current user, however polar detects docker only when launched as root:
sudo polar --no-sandbox

EDIT: i've reinstalled docker normally (without the docker desktop install) and did the post-installation steps and now it seems to be working fine without root.

@jamaljsr
Copy link
Owner

jamaljsr commented Jun 2, 2022

@riccardobl Thanks for the update and the workaround.

@antonilol would you mind trying to reinstall docker to see if this works for you as well?

@antonilol
Copy link

image
i clicked check again 4 times (notifications)

$ sudo /opt/Polar/polar --no-sandbox
12:01:48.165 › Starting Electron main process
12:01:48.309 › LndProxyServer: initialize
12:01:48.310 › LndProxyServer: listening for ipc command "get-info"
12:01:48.310 › LndProxyServer: listening for ipc command "wallet-balance"
12:01:48.310 › LndProxyServer: listening for ipc command "new-address"
12:01:48.310 › LndProxyServer: listening for ipc command "list-peers"
12:01:48.311 › LndProxyServer: listening for ipc command "connect-peer"
12:01:48.311 › LndProxyServer: listening for ipc command "open-channel"
12:01:48.311 › LndProxyServer: listening for ipc command "close-channel"
12:01:48.311 › LndProxyServer: listening for ipc command "list-channels"
12:01:48.311 › LndProxyServer: listening for ipc command "pending-channels"
12:01:48.311 › LndProxyServer: listening for ipc command "create-invoice"
12:01:48.312 › LndProxyServer: listening for ipc command "pay-invoice"
12:01:48.312 › LndProxyServer: listening for ipc command "decode-invoice"
12:01:48.312 › AppIpcListener: listening for ipc command "open-window"
12:01:48.312 › AppIpcListener: listening for ipc command "clear-cache"
12:01:48.312 › AppIpcListener: listening for ipc command "http"
12:01:48.313 › AppIpcListener: listening for ipc command "zip"
12:01:48.313 › AppIpcListener: listening for ipc command "unzip"
12:01:48.492 › Detecting language to use
12:01:48.494 ›   detected from Electron: en-US
12:01:48.495 ›   found an exact language match
12:01:48.585 › Starting React App in renderer process
12:01:48.604 › Rendering Home component
12:01:48.607 › Rendering App component
12:01:48.627 › skipped loading app settings because the file '/root/.polar/settings.json' doesn't exist
12:01:48.631 › skipped loading repo state because the file '/root/.polar/nodes.json' doesn't exist
12:01:48.644 › skipped loading networks because the file '/root/.polar/networks/networks.json' doesn't exist
12:01:48.646 › fetching docker version
12:01:48.651 › Failed: connect ENOENT /var/run/docker.sock
12:01:48.652 › getting docker-compose version
12:01:48.655 › env: uid=0 gid=0
12:01:48.703 › Result: {"exitCode":0,"err":"","out":"2.5.0\n","data":{"version":"2.5.0"}}
12:01:48.709 › fetching docker images
12:01:48.710 › Failed: connect ENOENT /var/run/docker.sock
12:01:52.101 › fetching docker version
12:01:52.107 › Failed: connect ENOENT /var/run/docker.sock
12:01:52.114 › Docker Error Error: connect ENOENT /var/run/docker.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
12:02:12.460 › fetching docker version
12:02:12.465 › Failed: connect ENOENT /var/run/docker.sock
12:02:12.466 › Docker Error Error: connect ENOENT /var/run/docker.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
12:02:12.924 › fetching docker version
12:02:12.932 › Failed: connect ENOENT /var/run/docker.sock
12:02:12.933 › Docker Error Error: connect ENOENT /var/run/docker.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
12:02:14.028 › fetching docker version
12:02:14.034 › Failed: connect ENOENT /var/run/docker.sock
12:02:14.035 › Docker Error Error: connect ENOENT /var/run/docker.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
12:02:14.669 › fetching docker version
12:02:14.672 › Failed: connect ENOENT /var/run/docker.sock
12:02:14.673 › Docker Error Error: connect ENOENT /var/run/docker.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)

again as said earlier, the error message is wrong, at first when starting polar, with or without sudo, it says 'docker not found', when i sudo systemctl start docker and click 'check again' it works, i dont start docker on startup to speed up the boot process. when i need it, i sudo systemctl start docker

#553 (comment)
#553 (comment)

@jamaljsr
Copy link
Owner

jamaljsr commented Jun 8, 2022

Ah right. you were running into a slightly different issue. I haven't had a chance to get a Ubuntu VM setup to investigate further.

@Marvel-Ib
Copy link

@antonilol Just had a similar issue while setting up. A fix that worked for me

For Docker:
after you install docker do this:

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker 

For Docker Compose use this guide:

https://www.smarthomebeginner.com/install-docker-on-ubuntu-22-04/

Move to the install docker-compose part

(newer tutorials install docker compose in .docker/cli-plugins/ vs installing it in /usr/local/bin/ ) and i dont think polar checks for the presense of docker compose in .docker/cli-plugins yet ) @jamaljsr

then restart your ubuntu os and try polar again it should work hopefully.

@thinkmassive
Copy link

thinkmassive commented Sep 1, 2022

The standalone docker-compose application is being deprecated in favor of the Compose plugin (used by docker compose). This error can happen when docker-compose is not installed but docker compose is available.

They claim it's a drop-in replacement, however I still notice some small differences, such as container names delimited by - instead of _ (which is likely to impact Polar).

EDIT: this delimiter issue is actually mentioned, and there's a --compatibility flag to make the newer version use the older delimiter, so a solution could be a simple as something like (see next comment)

@thinkmassive
Copy link

Here's an easy workaround that I just tested w/Polar:

echo 'docker compose --compatibility "$@"' > /tmp/docker-compose
chmod +x /tmp/docker-compose
sudo mv /tmp/docker-compose /usr/local/bin/

@Kodylow
Copy link

Kodylow commented Oct 26, 2022

Adding this here instead of making a new issue, running Polar on Mac for the first time and it can't detect Docker Desktop. The above worked for my ubuntu setup, but any way to fix detect docker desktop on Mac?

Most recent polar release, recommended docker desktop version from the "Download Docker Desktop" button in polar.

image

@jamaljsr
Copy link
Owner

@Kodylow I've had a few reports of this issue. I haven't been able to figure out why it happens on some Macs and not others, but there are a couple workarounds. What I observed is that this happens when opening Polar from the Spotlight search bar. For some reason, the PATH environment var fro the user's profile isn't being passed to Polar. So it cannot execute the docker-compose command.

Try these other methods of opening Polar to see if they work:

  1. Open Finder and browse to the /Applications/ dir. Double click on the Polar app
  2. Open a Terminal and type in the command open /Application/Polar.app

I also created #609 to provide a more permanent solution but It won't be available until the next release, unless you're interested in building from source and testing the PR.

@Kodylow
Copy link

Kodylow commented Oct 27, 2022

Tried both of those, same issue.

Built your PR from source and noticed that the docker.sock file isn't in /var/run anymore on mac, it's in the .docker folder.

Just have to run sudo ln -svf /Users/<USER>/.docker/run/docker.sock /var/run/docker.sock to symbolic link it. Built from your PR and it worked with manually inputting the path, redownloaded the most recent release and it works there too.
image

@jamaljsr
Copy link
Owner

Interesting. I had not realized that Docker changed this path. Oddly, mine is still in /var/run/ even though I'm using the latest Docker version. I wonder if this new path is only used for new installs. I'll have to look into these changes.

Thanks for this insight. It's very helpful 👌

@thinkmassive
Copy link

thinkmassive commented Oct 28, 2022

Keep in mind that standalone docker-compose is deprecated. It's been replaced by the compose subcommand.

https://docs.docker.com/compose/cli-command-compatibility/

It appears the standalone binary is still being released, but ideally new development should support docker compose.

There's also a translator app called compose-switch that seems targeted at downstream package maintainers, but it may also be of interest to end users.

Edit: The more I think about it, location of docker.sock is probably unrelated to this comment. If Polar interacts w/docker exclusively through the API then that file is probably all that's needed, but since #609 mentioned path of docker-compose I thought it might be helpful to point out this change.

@jamaljsr
Copy link
Owner

jamaljsr commented Nov 2, 2022

Yeah, I think the long term solution is just to remove the dependency on docker-compose and use the docker compose command instead going forward.

@tony-voltage
Copy link

tony-voltage commented Nov 3, 2022

[ignore me]

I had DOCKER_HOST set incorrectly in my zshrc file

@HannahMR
Copy link

Here's an easy workaround that I just tested w/Polar:

echo 'docker compose --compatibility "$@"' > /tmp/docker-compose
chmod +x /tmp/docker-compose
sudo mv /tmp/docker-compose /usr/local/bin/

This solution worked for me!

I have a new computer running Ubuntu 22.04 and so did a fresh install of Docker to get Polar up and running. The Docker site instructed me to install Docker desktop for Linux which I did. However when running the Polar app image (polar-linux-x86_64-v1.4.0.AppImage) it was at first unable to detect Docker or Docker Compose. After adding my user to the Docker group the Polar app image is able to detect Docker 20.10.21, but was still unable to detect Docker Compose.

I was able to confirm that both Docker and Docker compose were running on my machine, and Docker was running as a systemd service, but the error persisted until I tried the above.

It does seem that for me this issue was caused by not installing Docker Compose separately but instead installing it as a part of Docker desktop. Thanks for the fix.

@hodlbear
Copy link

hodlbear commented Jan 26, 2023

If you use a fresh Docker Desktop on Linux and are running into this, it could be because the Docker desktop application changes the context and doesn't use /var/run/docker.sock by default.
Something similar can also happen if you run a rootless docker or if you set DOCKER_HOST in .bashrc etc, DOCKER_HOST always takes precedence.

You can check the context, e.g. docker context ls, to show current context and sock file.
Removing DOCKER_HOST from .bashrc (see #482 for arch) and creating a symlink solved it for me.
sudo ln -s /home/<thisisyou>/.docker/desktop/docker.sock /var/run/docker.sock or see Kodylow's comment

Probably needs some docker context config/detection option added to polar or perhaps allow manual override of docker sock location in case of errors detecting.

@hdlslm
Copy link

hdlslm commented Jan 27, 2023

If you use a fresh Docker Desktop on Linux and are running into this, it could be because the Docker desktop application changes the context and doesn't use /var/run/docker.sock by default. Something similar can also happen if you run a rootless docker or if you set DOCKER_HOST in .bashrc etc, DOCKER_HOST always takes precedence.

You can check the context, e.g. docker context ls, to show current context and sock file. Removing DOCKER_HOST from .bashrc (see #482 for arch) and creating a symlink solved it for me. sudo ln -s /home/<thisisyou>/.docker/desktop/docker.sock /var/run/docker.sock or see Kodylow's comment

Probably needs some docker context config/detection option added to polar or perhaps allow manual override of docker sock location in case of errors detecting.

agreed i was having the same issue but for me (running arch linux) after 'docker context ls' i just ran 'docker context use "default" ' and polar was able to detect docker after, hopefully this will help someone else.

@hdlslm
Copy link

hdlslm commented Jan 30, 2023

If you use a fresh Docker Desktop on Linux and are running into this, it could be because the Docker desktop application changes the context and doesn't use /var/run/docker.sock by default. Something similar can also happen if you run a rootless docker or if you set DOCKER_HOST in .bashrc etc, DOCKER_HOST always takes precedence.
You can check the context, e.g. docker context ls, to show current context and sock file. Removing DOCKER_HOST from .bashrc (see #482 for arch) and creating a symlink solved it for me. sudo ln -s /home/<thisisyou>/.docker/desktop/docker.sock /var/run/docker.sock or see Kodylow's comment
Probably needs some docker context config/detection option added to polar or perhaps allow manual override of docker sock location in case of errors detecting.

agreed i was having the same issue but for me (running arch linux) after 'docker context ls' i just ran 'docker context use "default" ' and polar was able to detect docker after, hopefully this will help someone else.

ok i'm an idiot lol disregard the above. my resolution was exactly this: #553 (comment)

@brh28
Copy link

brh28 commented Sep 12, 2023

I encountered the same "Docker not detected" error due to permissions after upgrading polar. The docker post-installation instructions to create a docker group and add the current user did not work, but removing the ~/.docker/ directory did fix it. From the post-installation:

This error indicates that the permission settings for the ~/.docker/ directory are incorrect, due to having used the sudo command earlier.

To fix this problem, either remove the ~/.docker/ directory (it's recreated automatically, but any custom settings are lost), or ...

@jamaljsr jamaljsr added the up for grabs Anyone can work on this label Dec 19, 2023
@miguepollo
Copy link

I think i have the solution.
Is not running good because by default docker needs to run as root.
to remove that condition you have to add this
`
sudo groupadd docker
sudo usermod -aG docker yourusername

`
it works for me

@miguepollo
Copy link

And i forgot you have to reboot the system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working up for grabs Anyone can work on this
Projects
None yet
Development

No branches or pull requests