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

Requires Docker Desktop (mac os 13.2.1 on m2) #374

Closed
LeTak0 opened this issue Mar 25, 2023 · 24 comments
Closed

Requires Docker Desktop (mac os 13.2.1 on m2) #374

LeTak0 opened this issue Mar 25, 2023 · 24 comments
Labels
P:mac (homebrew) Issue related to homebrew

Comments

@LeTak0
Copy link

LeTak0 commented Mar 25, 2023

Dangerzone 0.4.0
Docker Desktop 4.17.0
Mac OS 13.2.1

After instlling Dangerzone it ask for Docker Desktop.
I installed Docker Desktop with the given link in dangerzone.
After the install , the message was still there, app not usable.
Restarted the system. problem still there.
reinstalled dangerzone and docker-desktop (with homebrew and with .dmg , in all 4 conbinations)
Problem still there. Is this like a permission problem from dangerzone or PATH problem with Docker?

@deeplow
Copy link
Contributor

deeplow commented Mar 27, 2023

Thanks for reporting the issue. After installing Docker Desktop the message changes to request you to start docker desktop. Do you remember starting it?

If not, please try the following:

  • start Docker Desktop
  • waiting a minute or to for the status indicator (bottom-left corner of Docker) to turn green
  • then opening Dangerzone

@LeTak0
Copy link
Author

LeTak0 commented Mar 27, 2023

Thanks for reporting the issue. After installing Docker Desktop the message changes to request you to start docker desktop. Do you remember starting it?

If not, please try the following:

  • start Docker Desktop
  • waiting a minute or to for the status indicator (bottom-left corner of Docker) to turn green
  • then opening Dangerzone

screen

Did that, also restarted Docker-Desktop and Dangerzone.

@LeTak0
Copy link
Author

LeTak0 commented Mar 27, 2023

How does dangerzone check if docker desktop is installed?

@deeplow
Copy link
Contributor

deeplow commented Mar 27, 2023

Thanks for the quick response. Then it seems like a problem where Dangerzone is not detecting properly docker.

How does dangerzone check if docker desktop is installed?

It does shutil.which('docker'), which should be the equivalent of running in the terminal which docker.

Can you try installing the dmg and running via the terminal? You can do this by running:
/Applications/Dangerzone.app/Contennts/MacOS/dangerzone-cli with a document as the first argument.

It could be that the GUI version doesn't detect docker but the CLI detects it. We've had this issue in the past.

2 similar comments
@deeplow
Copy link
Contributor

deeplow commented Mar 27, 2023

Thanks for the quick response. Then it seems like a problem where Dangerzone is not detecting properly docker.

How does dangerzone check if docker desktop is installed?

It does shutil.which('docker'), which should be the equivalent of running in the terminal which docker.

Can you try installing the dmg and running via the terminal? You can do this by running:
/Applications/Dangerzone.app/Contennts/MacOS/dangerzone-cli with a document as the first argument.

It could be that the GUI version doesn't detect docker but the CLI detects it. We've had this issue in the past.

@deeplow
Copy link
Contributor

deeplow commented Mar 27, 2023

Thanks for the quick response. Then it seems like a problem where Dangerzone is not detecting properly docker.

How does dangerzone check if docker desktop is installed?

It does shutil.which('docker'), which should be the equivalent of running in the terminal which docker.

Can you try installing the dmg and running via the terminal? You can do this by running:
/Applications/Dangerzone.app/Contennts/MacOS/dangerzone-cli with a document as the first argument.

It could be that the GUI version doesn't detect docker but the CLI detects it. We've had this issue in the past.

@deeplow
Copy link
Contributor

deeplow commented Mar 27, 2023

(github outage messed up the "comment" button)

@LeTak0
Copy link
Author

LeTak0 commented Mar 27, 2023

when I run 'which docker' in the terminal it returns 'docker not found' .
But in the activity monitor , there is a docker process running in '/Applications/Docker.app/Contents/MacOS/Docker'.

When I run dangerzone-cli , it is almost the same.
Assigning ID 'JxPNOi' to doc '/Users/anastasioskougioumtzidis/test.pdf'
Traceback (most recent call last):
File "dangerzone", line 13, in
File "click/core.py", line 1130, in call
File "click/core.py", line 1055, in main
File "click/core.py", line 1404, in invoke
File "click/core.py", line 760, in invoke
File "dangerzone/errors.py", line 103, in wrapper
File "dangerzone/cli.py", line 75, in cli_main
File "dangerzone/container.py", line 59, in install
File "dangerzone/container.py", line 103, in is_container_installed
File "dangerzone/container.py", line 51, in get_runtime
dangerzone.container.NoContainerTechException: docker is not installed
[77192] Failed to execute script 'dangerzone' due to unhandled exception: docker is not installed
[77192] Traceback:
Traceback (most recent call last):
File "dangerzone", line 13, in
File "click/core.py", line 1130, in call
File "click/core.py", line 1055, in main
File "click/core.py", line 1404, in invoke
File "click/core.py", line 760, in invoke
File "dangerzone/errors.py", line 103, in wrapper
File "dangerzone/cli.py", line 75, in cli_main
File "dangerzone/container.py", line 59, in install
File "dangerzone/container.py", line 103, in is_container_installed
File "dangerzone/container.py", line 51, in get_runtime
dangerzone.container.NoContainerTechException: docker is not installed

Could this be because I installed docker-desktop with brew?

@deeplow
Copy link
Contributor

deeplow commented Mar 27, 2023

Could this be because I installed docker-desktop with brew?

Good hypothesis. Let me check that on my system.

@apyrgio
Copy link
Contributor

apyrgio commented Mar 27, 2023

Could this be because I installed docker-desktop with brew?

Actually, this issue may be specific to your MacOS model and Homebrew installation. We see here that on Mac M1 laptops, you need to do a further step to add the binaries installed by Homebrew to the path. If you have a Mac M1 indeed, can you verify that /opt/homebrew is in your $PATH? Running brew doctor could be an option as well.

@LeTak0
Copy link
Author

LeTak0 commented Mar 27, 2023

the bin for docker is in /opt/homebrew/Caskroom/docker/4.17.0,99724/Docker.app/Contents/Resources/bin/docker , and I have
' /opt/homebrew$'
'/opt/homebrew/opt/swift/bin$'
'/opt/homebrew/bin$'
'/opt/homebrew/sbin$'
'/usr/local/bin$'
in my PATH.
But the direct docker path has a version number. so it would change the path with every update.
And docker is not in the above listed directories.

@LeTak0
Copy link
Author

LeTak0 commented Mar 27, 2023

Could this be because I installed docker-desktop with brew?

Actually, this issue may be specific to your MacOS model and Homebrew installation. We see here that on Mac M1 laptops, you need to do a further step to add the binaries installed by Homebrew to the path. If you have a Mac M1 indeed, can you verify that /opt/homebrew is in your $PATH? Running brew doctor could be an option as well.

Ok I ran brew doctor (thought it was a typo/autocompletion 'docker / doctor') and linked the keg.
Now the which docker command returns '/opt/homebrew/bin/docker'

We have progress. Running the dangerzone-cli now works. I can see in docker-desktop how it creates the containers and also deletes them after it finishes.

But dangerzone gui still does not work.

@deeplow
Copy link
Contributor

deeplow commented Mar 27, 2023

Now the which docker command returns '/opt/homebrew/bin/docker'

I was able to get this result by running `brew install docker. In this situation Dangerzone failed to detect it. I think this is because when Dangerzone is running it has the default path and the homebrew PATH mods don't get sourced.

After removing that docker and installing with brew install --cask docker. Docker was installed in /usr/local/bin/docker and Dangerzone did work.

@deeplow
Copy link
Contributor

deeplow commented Mar 27, 2023

When installing the Cask I think it's the same as downloading docker desktop from the official website via the .dmg

@LeTak0
Copy link
Author

LeTak0 commented Mar 27, 2023

I am using brew install --cask docker.
What did you do different ? Because I don't have docker in /usr/local/bin/ .

Funny is that if I uninstall docker with brew uninstall --cask docker , it ask for permission to delete docker from /usr/local/bin

@apyrgio
Copy link
Contributor

apyrgio commented Mar 27, 2023

Dummy question, but could it be that your current user session does not have the proper $PATH when you spawn Dangerzone from GUI? That is, could you log out and log back in?

@deeplow
Copy link
Contributor

deeplow commented Mar 27, 2023

I am using brew install --cask docker.
What did you do different ? Because I don't have docker in /usr/local/bin/

No idea.

Funny is that if I uninstall docker with brew uninstall --cask docker , it ask for permission to delete docker from /usr/local/bin

Indeed. According the the source of the cask it does in fact expect to delete it from there.

@LeTak0
Copy link
Author

LeTak0 commented Mar 27, 2023

Dummy question, but could it be that your current user session does not have the proper $PATH when you spawn Dangerzone from GUI? That is, could you log out and log back in?

Did not work. I restarted the Mac completely .

@LeTak0
Copy link
Author

LeTak0 commented Mar 27, 2023

I am using brew install --cask docker.
What did you do different ? Because I don't have docker in /usr/local/bin/

No idea.

Funny is that if I uninstall docker with brew uninstall --cask docker , it ask for permission to delete docker from /usr/local/bin

Indeed. According the the source of the cask it does in fact expect to delete it from there.

Also , it does not ask for permissions when installing. So it does not even try to write the file to /usr/local/bin

Found on stackoverflow(https://stackoverflow.com/questions/70983104/brew-installs-not-appearing-in-usr-local-bin) a link to this. https://brew.sh/2021/02/05/homebrew-3.0.0/
The installation directory is different on arm and x86 for brew.

Also on the homebrew FAQ page:

Why is the default installation prefix /opt/homebrew on Apple Silicon?
The prefix /opt/homebrew was chosen to allow installations in /opt/homebrew for Apple Silicon and /usr/local for Rosetta 2 to coexist and use bottles.

@LeTak0
Copy link
Author

LeTak0 commented Mar 27, 2023

This is not the best solution
sudo ln -s /opt/homebrew/bin/docker /usr/local/bin/docker
but it works.

Thank you

@LeTak0 LeTak0 closed this as completed Mar 27, 2023
@deeplow
Copy link
Contributor

deeplow commented Mar 27, 2023

Glad it's been resolved. Since this is not a supported configuration I don't think we'll have to fix this in code. Only a very small subset of users will find this. But it's good for us to be aware.

Thanks again, @Scr1p-tak

@dltj
Copy link

dltj commented Apr 20, 2023

Oddly, the latest docker.rb Cask definition doesn't seem to symlink the docker executable onto the path (although it will happily delete such a symlink if it is there). I found I had to do this on my Intel Mac:

ln -s  /Applications/Docker.app/Contents/Resources/bin/docker /usr/local/bin/docker

@kgadek
Copy link

kgadek commented Jul 17, 2023

I have the same problem. macOS 13, M1. My docker binary is in ~/.docker/bin, provided by Docker Desktop.

dangerzone-cli from the terminal works for me, as I have properly configured PATHs.

Would it be possible to add configuration for appending (or prepending or overriding) PATHs for dangerzone? It does seem /usr/local/bin is not going to be used any more frequently.

@deeplow deeplow added the P:mac (homebrew) Issue related to homebrew label Jul 18, 2023
@apyrgio
Copy link
Contributor

apyrgio commented Aug 4, 2023

Hey @kgadek, sorry for jumping in late here.

In my experience, it's not typical for a program to have a setting about the path where it will look for executables. Especially Dangezone, which does not rely on many external programs.

In my opinion, configuration issues like that should be resolved at the system level, so that CLI applications and GUIs can benefit alike. MacOS is not my daily driver, but I see that others have found a solution to this. Hopefully it helps.

Alternatively, other solutions like symlinking can also help, and they apply to the whole system as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P:mac (homebrew) Issue related to homebrew
Projects
None yet
Development

No branches or pull requests

5 participants