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

desktop notifications do not appear when used inside docker #948

Open
ronald opened this issue Nov 6, 2019 · 3 comments
Open

desktop notifications do not appear when used inside docker #948

ronald opened this issue Nov 6, 2019 · 3 comments

Comments

@ronald
Copy link

ronald commented Nov 6, 2019

I checked https://github.com/guard/guard/wiki/System-notifications but did not find any hints on using guard inside docker.

I use guard inside docker container with the command: bundle exec guard --no-bundler-warning --no-interactions
Is there any way to enable desktop notifications on the host system?

Thanks in advance

@kwerle
Copy link

kwerle commented Apr 23, 2020

This isn't so much a guard issue as a growl issue. There really aren't any standard notification mechanisms from inside a container to outside.

@ibrahima
Copy link

ibrahima commented Mar 1, 2022

I realize this is a little old, but for reference, you should be able to send notifications notifications from inside your Docker container to your host via Growl/GNTP with a line like this:

ip_addr = `ip addr list eth0 |grep "inet " |cut -d' ' -f6|cut -d/ -f1`.strip
growl_host = "#{ip_addr.rpartition('.')[0]}.1"
notification :gntp, sticky: false, host: growl_host, password: "password"

There might be a better way to get the IP address of the Docker host from inside the container, but I think that snippet works. If on Docker for Mac or Windows, I think you can use host.docker.internal inside the container, but it's not part of the Linux Docker installation unfortunately.

Amusingly, I came here to this issue tracker to see if there was a better way to do this than use Growl, but it looks like this might still be the easiest way 😕.

@ronald
Copy link
Author

ronald commented Mar 1, 2022

With docker-compose on Linux you can set:

    extra_hosts:
      - "host.docker.internal:host-gateway"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants