I am running a local instance of my webapp on my machine and am trying to access it from within a docker container. My docker container contains my testframework using selenium.
Usually this wouldn't be a problem when the app is accessible via localhost and using host.docker.internal
, but the webapp is using a proxy by webpack-devserver:
devServer: {
hot: true,
port: 6555,
proxy: [
{
context: ['/api/**', '/public/**'],
target: 'http://myapp:5555'
}
]
}
I am able to access any other website from within the container, only http://myapp:6555 produces "This site can't be reached". Accessing http://myapp:6555 from the hostmachine works.
This is my docker-compose:
version: "3.4"
services:
hub:
image: selenium/hub:latest
chrome:
image: selenium/node-chrome
shm_size: '2gb'
depends_on:
- hub
environment:
- HUB_HOST=hub
- HUB_PORT=4444
test:
image: testframework:latest
shm_size: '2gb'
depends_on:
- chrome
environment:
- URL=http://myapp:6555
The search only showed solutions for either when both applications are in a docker container or when the webapp is not using a proxy. Unfortunately both are not an option for me.