I have multiple apps running with Laravel Herd (let's say myapp1.test
and myapp2.test
).
I want to test the functionality of a service by having it run in docker. That service needs to access an endpoint on myapp (myapp1.test/endpoint
).
Since myapp1
and myapp2
are not running inside docker containers themselves, and are not accessible with -just- an IP address, is there a way for my service inside docker to have access to that endpoint?
If I just use the url (myapp1.test/endpoint
) the app inside my docker container tries to connect to 127.0.0.1
inside the docker image, which doesn't find my app.
I have tried with --add-host=host.docker.internal:host-gateway
which doesn't work either.
And with --network=host
I can't seem to find the app running, which is supposed to be serving on port 9090
(appears to be because this option doesn't allow apps inside the container to link to the host's IP address).
I tried looking into using the herd proxy command but it also didn't give me promising results.
Any idea if/how to make this work?
(Running on MacOS Sequoia 15.0.1)
UPDATE :
Manage to get it working with docker run --add-host=myapp1.test:host-gateway
Had some trouble getting my docker app fetching the data correctly because it's a secure link with unverified certificate, but
wget --no-check-certificate https://myapp1.test:443/
worked from inside the container!