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 container: access linux host #293

Merged
merged 1 commit into from
Jul 16, 2022

Conversation

pavloskafritsas
Copy link
Contributor

This PR adds host.docker.internal:host-gateway to extra_hosts section in docker-compose.yml

In docker for Mac and Windows hosts, we can connect to the host out of the box by using the special DNS name:host.docker.internal.

When docker is running under linux host, this is not the case. Under linux we need the magic string host-gateway to map to the gateway inside the container. This allows the hostname host.docker.internal to access the host from inside a container.

This fix is necessary for Linux users that use expose under docker and the webserver they want to expose is running as docker container too (ex. laravel sail).

The issue is explained in depth in this this article:
https://medium.com/@TimvanBaarsen/how-to-connect-to-the-docker-host-from-inside-a-docker-container-112b4c71bc66

@Jamesking56
Copy link

Bump please, expose does not function on Windows / WSL2

@riyuk
Copy link

riyuk commented Jul 6, 2022

@mpociot since laravel/sail uses the latest version of expose this currently breaks sail share on Windows WSL2. it would be awesome to get some progress here since expose currently isnt useable with laravel sail on WSL2.

App\Client\ProxyManager::createProxy(): Argument #1 ($clientId) must be of type string, null given, called in /app/Client/Connections/ControlConnection.php on line 52 {"exception":"[object] (TypeError(code: 0): App\\Client\\ProxyManager::createProxy(): Argument #1 ($clientId) must be of type string, null given,
 called in /app/Client/Connections/ControlConnection.php on line 52 at /app/Client/ProxyManager.php:26)

@m33ts4k0z
Copy link

Another bump since this is really important.

@sschlein sschlein merged commit c204d35 into beyondcode:master Jul 16, 2022
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

Successfully merging this pull request may close these issues.

5 participants