chipmk / docker-mac-net-connect

Connect directly to Docker-for-Mac containers via IP address 🐳 💻
MIT License
402 stars 41 forks source link

Doesn't work on M2 Mac #19

Closed danieljausovec closed 1 year ago

danieljausovec commented 1 year ago

While it does work for me on M1, it does not on M2 one.

I reinstalled package and restart service

sudo brew services restart chipmk/tap/docker-mac-net-connect

Warning: Taking root:admin ownership of some docker-mac-net-connect paths:
  /opt/homebrew/Cellar/docker-mac-net-connect/v0.1.2/bin
  /opt/homebrew/Cellar/docker-mac-net-connect/v0.1.2/bin/docker-mac-net-connect
  /opt/homebrew/opt/docker-mac-net-connect
  /opt/homebrew/opt/docker-mac-net-connect/bin
  /opt/homebrew/var/homebrew/linked/docker-mac-net-connect
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
Warning: docker-mac-net-connect must be run as non-root to start at user login!
==> Successfully started `docker-mac-net-connect` (label: homebrew.mxcl.docker-mac-net-connect)

Services list

brew services

Name                   Status User File
docker-mac-net-connect none   root

After that I followed first example with nginx

curl -I 172.17.0.2

curl: (28) Failed to connect to 172.17.0.2 port 80 after 75012 ms: Operation timed out

Am I doing something wrong?

danieljausovec commented 1 year ago

@dobegor Do you have come across a possible similar case? (I saw that you had a problem with M1)

peterpacket commented 1 year ago

I have com across a similar case (but with a redis container). Downgrading docker for Mac to 4.12 fixed the issue for me (I was on version 4.13).

dobegor commented 1 year ago

@danieljausovec I don't have an M2 and the problem on M1 was different.

I did try it on M1 and it doesn't work:

$ brew services list
Name                   Status     User    File
docker-mac-net-connect error  256 georgiy ~/Library/LaunchAgents/homebrew.mxcl.docker-mac-net-connect.plist
postgresql@14          none
vault                  none

I also tried to launch the service manually:

/opt/homebrew/opt/docker-mac-net-connect/bin/docker-mac-net-connect
docker-mac-net-connect version 'v0.1.2'

Downgrading docker for Mac to 4.12

I'm actually running DfM 4.12.0. cc @gregnr

danieljausovec commented 1 year ago

@peterpacket @dobegor I tried with Docker version 4.13 on M1 and it doesn't work. After downgrading to 4.12 has started working again, but I still have problems with M2 with both Docker versions.

Apparently, Apple has changed something. Maybe @gregnr can help?

xinbe commented 1 year ago

I have the same problem with docker for desktop 4.13 on M1. I tried tail -f /opt/homebrew/var/log/docker-mac-net-connect/std_* and found some possible issues.

https://docs.docker.com/desktop/release-notes/#docker-desktop-4130

For Mac Added Hide, Hide others, Show all menu items for Docker Desktop. See docker/for-mac#6446. Fixed a bug which caused the application to be deleted when running the install utility from the installed application. Fixes docker/for-mac#6442. By default Docker will not create the /var/run/docker.sock symlink on the host and use the docker-desktop CLI context instead.

It seems that 4.13 adjusted the path generated by the unix socket.

sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock

I'm currently manually creating the symbol link and it's working for me.

danieljausovec commented 1 year ago

Guys, It started working. What I did...? I downgraded the docker version to 4.12 and after that, I upgraded it back to 4.13, and now works as expected.

dobegor commented 1 year ago

This happens for me on Docker 4.12 without any upgrade to 4.13. And also this is still an issue even if it worked on 4.12. @danieljausovec could you please reopen the issue?

mhumeSF commented 1 year ago

This too has stopped working for me recently on my macbook air m1 with the following versions of docker-desktop 4.12, 4.13.1, 4.14. Not finding any error in the logs. The only message that gets printed is docker-mac-net-connect version 'v0.1.2'.

Update: I reran using sudo and the interface and routes were created and working as expected. I still get errors returning from the brew service... but the connection is working.

➜ brew services start chipmk/tap/docker-mac-net-connect
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/mhumesf/Library/LaunchAgents/homebrew.mxcl.docker-mac-net-connect.plist` exited with 5.
konnta0 commented 1 year ago

It seems to be related to the following issue https://github.com/chipmk/docker-mac-net-connect/issues/19

Also, as noted in the comments below, uninstalling and then reinstalling Docker Desktop For Mac: 4.17.0 may resolve the issue. In no small part, it eliminated the problem on my Apple M2 Pro!!! https://github.com/chipmk/docker-mac-net-connect/issues/21#issuecomment-1403770451

gregnr commented 1 year ago

Hey, jumping in here to help resolve these. A couple notes:

@danieljausovec thanks for opening this issue. Looks like this is resolved for you, but let me know if you're getting any more errors.

@dobegor can you confirm whether or not you've got this working? Can you try on the latest 4.17.0?

@mhumeSF it sounds like this was resolved for you by using sudo. I'm not sure what is causing that additional error, but feel free to open a new issue if that persists.

danieljausovec commented 1 year ago

Hey, jumping in here to help resolve these. A couple notes:

@danieljausovec thanks for opening this issue. Looks like this is resolved for you, but let me know if you're getting any more errors.

@dobegor can you confirm whether or not you've got this working? Can you try on the latest 4.17.0?

@mhumeSF it sounds like this was resolved for you by using sudo. I'm not sure what is causing that additional error, but feel free to open a new issue if that persists.

Yes, I can confirm that it works with docker 4.17.0 (on an M1 and M2 chip) after reinstalling the service.

dobegor commented 1 year ago

Hey, jumping in here to help resolve these. A couple notes:

@danieljausovec thanks for opening this issue. Looks like this is resolved for you, but let me know if you're getting any more errors.

@dobegor can you confirm whether or not you've got this working? Can you try on the latest 4.17.0?

@mhumeSF it sounds like this was resolved for you by using sudo. I'm not sure what is causing that additional error, but feel free to open a new issue if that persists.

I can confirm that the tool works for me with DfM 4.17.0 on M1 Pro. Thanks a lot for pointing that out!

gregnr commented 1 year ago

@danieljausovec @dobegor great! Closing this now, but if anyone is experiencing issues with 4.17.0, let me know and we can re-open. Otherwise feel free to create a new issue!